The first thing to keep in mind is the Guidelines are very explicit about programmatic termination. From
Stopping in the +iPhone Human Interface Guidelines+:
That said, I guess you didn't post your question to get a lecture on the HIG, so I'll pass on what little I know. I think the alternatives to exit() are \[\[NSThread mainThread\] cancel\] and/or sending \[NSThread exit\] from the main thread. I haven't tried those yet, so dunno if either is any different than exit(). Based on most of what I've read from other developers, the consensus seems to be exit(0), but do your own cleanup just ahead of that. I.e. send your own applicationWillTerminate to the delegate, synchronize any user defaults, etc. I'm guessing nothing essential to the health of the system (like deallocating memory) will fail to happen, so I think you just need to test and find out if you've missed any of your private cleanup.
I'm also guessing I haven't said one thing you didn't already know, but it's the best I can do.
\- Ray
iPhone applications should never quit programmatically because doing so looks like a crash to the user. There may be times, however, when external circumstances prevent your application from functioning as intended. When this happens, you need to tell users about the situation and explain what they can do about it. This way, users decide whether they want to take corrective action and continue with your application or press the Home button and open a different application.
That said, I guess you didn't post your question to get a lecture on the HIG, so I'll pass on what little I know. I think the alternatives to exit() are \[\[NSThread mainThread\] cancel\] and/or sending \[NSThread exit\] from the main thread. I haven't tried those yet, so dunno if either is any different than exit(). Based on most of what I've read from other developers, the consensus seems to be exit(0), but do your own cleanup just ahead of that. I.e. send your own applicationWillTerminate to the delegate, synchronize any user defaults, etc. I'm guessing nothing essential to the health of the system (like deallocating memory) will fail to happen, so I think you just need to test and find out if you've missed any of your private cleanup.
I'm also guessing I haven't said one thing you didn't already know, but it's the best I can do.
\- Ray