• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Terminating UIApplication and exit() (was Re: NSApplication and UIApplication)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSApplication and UIApplication (From: DKJ <email@hidden>)

  • Prev by Date: How to share Cocoa classes?
  • Next by Date: Re: How to share Cocoa classes?
  • Previous by thread: Re: NSApplication and UIApplication
  • Next by thread: Problem with NSDecimalNumber truncating zeros
  • Index(es):
    • Date
    • Thread