Bubbles and Busts had a very nice post on the Impossible Trinity (the fact that an economy cannot simultaneously maintain a fixed exchange rate, free capital movement, and an independent monetary policy) and how it is related with Interest On Reserves (IOR). Since IOR, especially in a floor system, allows a central bank (CB) to “sterilize” the expansion of the monetary base (and keep control of the short-term interest rate) it ultimately can help avoid problems in some cases of exchange rate targeting.
In particular, while a currency peg with an external deficit implies that the central bank must be able to sell enough FX in order to maintain the peg (either by already having large FX reserves or by being able to borrow from official sources) thus making the peg unstable, a CB can avoid its FX rate from appreciating by buying FX and selling its local currency (a clear example is the Euro currency floor for the Swiss franc by the SNB). By paying IOR, the CB can maintain a non-zero interest rate target despite of the monetary base expanding (due to FX intervention). In any other case, the CB would have to use other measures to sterilize its operations such as increasing reserve requirements (the usual policy followed by PBoC) or selling securities (outright or through reverse repos) held in its portfolio.
What I would like to note is that, unless the capital inflows are a result of flight to quality and thus temporary (such as the inflows to the Swiss franc), they usually reflect strong underlying factors such as a current account surplus and/or large interest rate differences. In such a case, the currency appreciation will not really end unless the original cause is reversed. As a result, the CB might end up in a position where a large part of its asset base is in foreign currency and paying low interest rates while its liabilities are in the form of local currency and paying much higher rates. Ultimately, the question of avoiding the trilema is one of if the CB can accept long-term losses on its operations and even a negative capital base. This question has been asked sometimes (especially in the case of the SNB and ECB) but with no clear and definite answer (although the Asian central banks seem to be less concerned with the problem).