Reputation: 1869
I do not want my app to switch to the "task bar" when the Home button is pressed. That's why I would like it to be closed upon Home press. I added this entry to the info.plist file but this does not change the behaviour:
application does not run in background
(and I checked the box...)
I rebuilt the whole app both in debug and release mode but no way. I heard of another key which should be added to the info.plist but I cannot add it through Xcode:
UIApplicationExitsOnSuspend
What is the right way to do that ?
Regards,
Franz
Upvotes: 6
Views: 8312
Reputation: 360
You can manually close the application after home button is pressed. When home button is pressed applicationDidEnterBackground
is called. In this delegate just write exit(0)
and your application will be ended instantly.
Upvotes: 1
Reputation: 55334
On iOS 4, multitasking is enabled in Xcode projects by default. This prevents the applicationWillTerminate
method from being called. If you do not want to support multitasking, place UIApplicationExitsOnSuspend
in your MyAppName-Info.plist file and check the checkbox. If you do want to support it, place any code in the applicationDidEnterBackground
delegate method that you want to execute before the application enters an inactive state.
Upvotes: 17
Reputation: 2937
What you're doing will indeed stop the application from running in the background, but you can't prevent it from going to the multitasking bar still. Sorry.
Upvotes: 1