On the SO this question is asked before so many times, you should definitely know that,
On the iPhone there is not any concept of quitting an app. The only action that should cause an app to quit is touching the Home button. Unfortunetly developers do not have access for it
According to Apple, your app must not terminate on its own. Since the user did not hit the Home button, any return to the Home screen gives the user the impression that your app crashed.
The answers given below are totaly wrong, you must not use exit function in any case, even apple will reject such kind of apps.
You can checkout apple's QA report for your reference.