Such an application already exists for iOS as well. It is called iKeyGuard and works on every iPhone, iPad, or iPod touch, as long as it has been jailbroken. Once the keylogging app has been installed, it remains hidden in the background and starts doing what it is made for without making the slightest hint about its existence. It is capable of recording key presses from any app, not only your text messages and emails, and it can even secretly send the log files over the web to a specified email address at a given time of the day.
The app does not come cheap though. iKeyGuard will set you back $9.99, but depending on what it is being used for, it can be worth every single penny of its price. Those of you who think they may be spied on with the app, try typing http://localhost:4444 in your iDevice's browser and hope that a log with your key presses does not come up.
source: iKeyGuard via Redmond Pie