views:

254

answers:

2

I my testing, when I exit (by pressing the home button) my app, it still is "running" in the background, thanks to the multitasking feature. However, I would like it to quit when the home button is pressed. Is this only happening to me?

Anyways, I have tracked it down to the applicationWillResignActive and the applicationDidBecomeActive methods in the app delegate. These get called for multitasking, but when I want to terminate, the app "resigns active." Any guidance on this issue is greatly appreciated!

+16  A: 

Your application can opt out of multitasking (see the appropriate section in the iPhone Application Programming Guide) by adding the UIApplicationExitsOnSuspend key to your Info.plist and setting its value to YES.

In practice, Apple strongly recommends you not do this unless you have a very good reason for this behavior.

Brad Larson
You should consider whether or not doing this will annoy your users. They will probably expect that your app remembers where they were, and circumventing this behavior might make them think your app is broken.
Jason
A: 

I wouldn't recommend trying to control the user's HOME button... deciding for them "exit" or "suspend".

I WOULD like to have HOME do an instant EXIT in the iPhone simulator... but haven't found any way to do that.

Annette
I set the `UIApplicationExitsOnSuspend` key during development, and then unset it before doing final testing and release.
Brian