Reputation: 4664
I have just discovered the nifty unhandled exception handler for cocoa-touch.
Now that I can gracefully notify the user about any unhandled exceptions that might crash my application, I'd like to shut down my application after notifying the user that a crash has occured.
Does anyone know how to shut down an application programmatically?
Upvotes: 2
Views: 4069
Reputation: 6023
Apple's documentation says there is no "normal" way to shut down. In your case - an unhandled exception - immediate termination makes sense anyway.
Upvotes: 0
Reputation: 57139
You can call [[UIApplication sharedApplication] terminate]; - that won't build the screenshot Springboard uses to animate the application's exit, though, so the screen will just go black until the icons move in. There doesn't seem to be a published way to do this; the UIApplication header doesn't even mention the -terminate method, so you may just not be meant to do it at all.
Upvotes: 6