Even with this built-in convenience, they are times when this default behavior may not be ideal. For example, depending on the application, it may require a fair amount of additional development time to properly manage this state change. In such cases, simply quiting the application may be preferred.
UIApplicationExitsOnSuspend
To request the application exit rather than be suspended, add the key UIApplicationExitsOnSuspend to the application’s plist file. The figure below shows how this looks if you edit the plist as an XML file.<plist version="1.0">
<dict>
...
<key>UIApplicationExitsOnSuspend</key>
<true/>
...
</dict>
</plist>
Application Shutdown
If you’ve added the plist entry above, just as on non-multitasking devices, when the user taps the Home key the method applicationWillTerminate: in the application delegate will be called. You have somewhere in the neighborhood of 5 seconds to save any pertinent information before the application is terminated.Although there are times to use this approach, it is generally recommended for the best user experience to design/develop your applications to manage being placed into the background.
No comments:
Post a Comment