问题
I set the UIApplicationExitsOnSuspend to boolean and checked the checkbox, so I assumed that
- (void) applicationDidEnterBackground:(UIApplication *)application
is not called - but I always get into that method when I click the home button in my simulator. Am I doing something wrong or can I be sure that the app will behave the "old style" and does not support multitasking?
Thanks a lot,
Stefan
Settings defined at this level
Architectures: Standard
Base SDK: iPhone Simulator 4.0
Code Signing Identity: iPhone Developer: myName
Any iPhone OS Device: iPhone Developer: myName
iPhone OS Deployment Target: iPhone OS 3.1
Other Linker Flags: -lxml2
Prebinding: not selected
Header search paths: /usr/include/libxml2
C language dialect: C99 [-std=99]
Mismatched Return Type: selected
Unused variables: selected
回答1:
One difference I have found to test this is using the iPhone 4 Simulator or Device connected to the Xcode debugger. If you have it enabled properly, when you hit the home button it will exit the debugger. If "multitasking" is enabled, when you hit the home button, the debugger will not exit - touching your icon and bringing it back will continue with your debugging session.
回答2:
http://www.drobnik.com/touch/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/
A must read for that problem with a FLowChart what happens when on iOS4
回答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..;)
回答4:
The key UIApplicationExitsOnSuspend works fine only on device iPhone 4. It doesn't work on iPhone 3GS even if you installed iOS4 and have multitasking. That's what our tests show.
回答5:
During my tests applicationDidEnterBackground
is called (and afterwards ApplicationWillTerminate
), although I've set UIApplicationExitsOnSuspend
to YES
, too. I've tested the app on an iPhone 3G with iOS 4.1 installed and in the iPhone 4 Simulator.
Has somebode tested this on an iPhone 4?
回答6:
I had the same problem. What worked for me is converting my info.plist file to xml. I created a new blank project just to see the info.plist file and saw that it was in xml, whereas my older project did not have info.plist in xml format. So, I used the new info.plist xml format to rewrite my info.plist file. After doing that, the UIApplicationExitsOnSuspend key now works and my app terminates
来源:https://stackoverflow.com/questions/3188076/iphone-how-to-test-if-uiapplicationexitsonsuspend-is-working