Enabling Multitasking
I am trying to add multitasking support for my iPad (4.3) Application. Currently when the application enters the back ground the app receives the command applicationDidEnterBackground but then immediately after gets the command applicationWillTerminate essentially killing开发者_StackOverflow the application so that when the application is resumed from the background it is as if the application opened for the first time. I have set UIApplicationExitsOnSuspend to false in the info.plist file. How can I get multitasking to properly work in my application and not have the app terminate when it enters the back ground?
How much memory does your application use? iOS may be terminating it to free up resources.
If your app is loading a lot of images (and not responding to memory warnings), it may have consumed most of the available memory, which means that iOS will need to kill it just to load the Home screen.
Here is how I've done that:
- (void)applicationDidEnterBackground:(UIApplication *)application {
[self applicationWillTerminate:application];
}
- (void)applicationWillTerminate:(UIApplication *)application {
[gameViewController appWillResignActive];
}
where appWillResignActive is my method to preserve a game's state.
精彩评论