Posts Tagged ‘iPhone API’

How to terminate iPhone application from code

June 18, 2009

Today i had to terminate an application, if certain launch conditions where not met (settings not filled out more specifically). I started out searching for information regarding UIApplication, but it turned out that a simple C call does the job: exit(0);

Update: As is pointed out in comments, there seem to be some content as to wether explicitly exiting an application will result in failure to pass the Apple AppStore aproval process.

In my case i was building a pure online app. If no connection could be established on startup, the user would be presented the option to retry or cancel. Cancel would result in the app exiting. Pretty rutine behavior, but I guess I could just remove the cancel button and leave it up to the user to use the hardware button.

In light of the new information then, the proper recommendation has to be do not terminate apps explicitly.