Terminating UIApplication and exit() (was Re: NSApplication and UIApplication)
Terminating UIApplication and exit() (was Re: NSApplication and UIApplication)
- Subject: Terminating UIApplication and exit() (was Re: NSApplication and UIApplication)
- From: mmalc Crawford <email@hidden>
- Date: Mon, 06 Jul 2009 11:53:04 -0700
On Jul 6, 2009, at 11:38 AM, DKJ wrote:
I want to terminate my UIApplication under some specific error
conditions. I'm used to doing this kind of thing using:
[[NSApplication sharedApplication] terminate];
But docs don't show a terminate method for UIApplication. Apparently
it will respond to the message regardless; however, I'm very wary of
using it if neither the compiler nor the docs mention it.
What should I do with UIApplication in these circumstances?
(exit(0) seems a bit extreme.)
Typically you should not offer an option to quit an iPhone
application. It's up to the user to decide when they want to quit by
pressing the Home button.
This is a convenient time to mention the use of exit() in the Core
Data application templates for iPhone.
In defiance of the preceding comment, the templates use exit()
precisely to indicate that you should do something at that point. If,
for example, your application can't load the persistent store, then
realistically your application cannot continue. If it does, then the
user may or may not be able to use parts of the application, but
whatever data they add or can edit will be lost, and the application
will eventually fail in an odd way...
So you should present an alert at that point, telling the user that
the application cannot be used and that they should quit.
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden