Reputation: 18149
I have a cocos2d-iphone 1.0.1
game. A tester has found a strange issue. The steps:
Very often, this will cause the game to reboot. Not exactly crash: the game doesn't close itself - it just restarts from the splash screen. I myself am unable to reproduce this, but the tester has the following info:
The tester has a log, and the most eye-catching fact about it is this:
Arthurs-iPhone com.apple.launchd[1] (com.apple.mobile.installation_proxy[4825]) <Notice>: (com.apple.mobile.installation_proxy) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Arthurs-iPhone com.apple.launchd[1] (com.apple.mobile.installation_proxy[4825]) <Error>: (com.apple.mobile.installation_proxy) assertion failed: 11D257: launchd + 35833 [1A6C526C-3CCA-3E32-B3C0-F448B1D16C89]: 0x9
Arthurs-iPhone com.apple.launchd[1] (com.apple.sandboxd[4818]) <Notice>: (com.apple.sandboxd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
And several lines that are pretty much the same thing. As you can observe, iOS seems to be jettisoning apps, suggesting that there is a lack of memory. However, this is very odd, because
So it is hardly believable that iOS needs to do this at all.
My best bet seems to be checking out AppDelegate
- after all, here are the method implementations for when the app enters/exits the foreground.
-(void) applicationDidEnterBackground:(UIApplication*)application {
[[CCDirector sharedDirector] pause];
[[CCDirector sharedDirector] stopAnimation];
}
-(void) applicationWillEnterForeground:(UIApplication*)application {
[[CCDirector sharedDirector] resume];
[[CCDirector sharedDirector] startAnimation];
[[GameManager sharedManager] refreshInterface]; // Just update the interface
}
- (void)applicationWillResignActive:(UIApplication *)application {
[[CCDirector sharedDirector] pause];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[[CCDirector sharedDirector] resume];
}
And it all seems to be in order.
What could be happening, then?
Upvotes: 0
Views: 190
Reputation: 64477
The simplest explanation: Safari needs a lot of memory. Therefore iOS decides to close unneeded background apps to free more memory.
Overall you needn't worry about this happening because it can happen at any time on any device. Even users themselves can forcefully close background apps. Double-tap the home button, then swipe up on the preview image of the application to terminate it.
It doesn't seem to be an error but rather normal iOS behavior. What you need to do is to ensure that the app - when it was terminated while being in the background - doesn't lose any important data such as in-app progress. At worst the player may need to restart from the checkpoint or level that was last started, but the app shouldn't revert back to, say, level 1.
You should probably implement applicationWillTerminate:
in order to perform any last-minute householding steps.
Upvotes: 1