UIApplicationExitsOnSuspend anything else I'm missing?
Asked Answered
L

6

8

So I know this has been beaten to death but I still can't figure out a solution.

I have my UIApplicationExitsOnSuspend set to <true/> in the Info.plist and still both in the simulator as well as on an iPhone 4 device, the app goes into standby instead of terminating?

Any ideas of what else could one do to get it to terminate? Perhaps are there methods that I need to remove from the app delegate? Any ideas?

Lakenyalaker answered 2/8, 2010 at 14:58 Comment(1)
i am having same problem , did u find solution yet?Triton
E
8

Did you do a clean build, delete the app from both the simulator and the device, and re-install? That's the only key that affects it. Also, make sure you are building with base SDK set to iOS 4.0.

UIApplicationExitsOnSuspend (Boolean - iOS) specifies that the application should be terminated rather than moved to the background when it is quit. Applications linked against iPhone SDK 4.0 or later can include this key and set its value to YES to prevent being automatically opted-in to background execution and application suspension. When the value of this key is YES, the application is terminated and purged from memory instead of moved to the background. If this key is not present, or is set to NO, the application moves to the background as usual.

Edmundson answered 2/8, 2010 at 15:13 Comment(7)
I deleted the build directory and also reset the settings on the simulator. Then I installed the newly compiled binary onto an iPhone 4. Alas no luck in both sim, device. Do these steps constitute making a clean build?Lakenyalaker
Normally just doing a "Clean All Targets" from the menu in XCode is enough since it does essentially what you just did.Edmundson
Tried that, still going into background/suspend mode... I don't get it. My SDK used is 4.0 and its good with backwards all the way to 3.1 Is there anything in the build flags?Lakenyalaker
Here's a further update: My app goes into the applicationDidEnterBackground: and then it goes into the applicationWillTerminate: By passing both it gets suspended... Do I need to add something special to applicationWillTerminate ? abort()?Lakenyalaker
No, the application should terminate on its own. Like I said, that key determines if it exits or not. If you set it as a boolean value of TRUE and you are indeed reading off of that info.plist file, it should work. Update the app name in the info.plist file and make sure you are getting updates from it in your build.Edmundson
I know it sounds like I'm out of whack but I have tried changing the plist to a different display name and it shows the modifications on the simulator and yet still the program doesn't terminate. I have even changed in the build settings for the Info.plist to be output as XML instead of binary and went to the .app directory in iterm to check if the plist shows <true> and it does. Here is a copy of the "cat Info.plist" file inside the .app directory <key>UIApplicationExitsOnSuspend</key> <true/> any other ideas? I'm really not getting it. Why would it not terminate.Lakenyalaker
I understand your frustration, but if that key isn't working, then there is a bug in your particular case. Contact Apple about it. The only other way applicationWillTerminate is called (other than with that key) is if you are building with another SDK other than 4.0, in which case multi-tasking is not available.Edmundson
S
5

I had the same problem that Cyril identifies: I pasted "YES" in as the value, but that made the key default to String instead of "Boolean". So right-click the key and make sure its type is Boolean.

Shiv answered 5/1, 2011 at 20:50 Comment(0)
S
3

Setting YES to UIApplicationExitsOnSuspend , worked well for me from the first time,But i didn realize,as my app was shown when double-clicking.

"double-clicking on the home button will always show your app , as it is a list of recently used apps. ( Ref: http://www.apple.com/iphone/features/multitasking.html ) "

If applicationWillTerminate delegate method is called, then you are done with that.. (Add a break point or NSLog to check )

Just a tip. Hope this helps some one like me..;)

Spree answered 26/12, 2010 at 13:51 Comment(0)
C
2

I had the same problem, when you add the key UIApplicationExitsOnSuspend, make sure you right click on it and select value type > Boolean. Otherwise Xcode will ignore it. Hope it helps

Capreolate answered 21/12, 2010 at 4:10 Comment(0)
G
1

This appears to have changed (for the better) in Xcode4 / iOS 4.3. The boolean is now "Application does not run in background", and - well - it works for me.

Gluten answered 20/3, 2011 at 15:28 Comment(1)
That's just the 'friendly' name.Recount
E
0

It's important to note that your AppDelegate's "applicationDidEnterBackground" and "applicationWilLTerminate" methods are both called (in that order), even if your UIApplicationExitsOnSuspend is marked as (boolean) "YES".

Easeful answered 5/7, 2011 at 22:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.