Removing app from background while debugging
I am debugging an issue for my app in iOS 4 and above where it doesn't appear to save progress when it's closed. I'm using Xcode 4.0 and running it in the simulator, and, when I close the app in the simulator, remove it from the background apps bar, then relaunch it from the simulator, it appears to break in the retval line below:
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
It cites "Thread 1: Program开发者_如何学JAVA received signal: "SIGKILL" and I'm not quite sure what to make of it (also I'm just minutes new to using Xcode 4).
Can someone explain what's going on here, whether I simply can't debug once I stick an app in background (and/or remove it), or whether this potentially points to my issue with saving progress? I basically trigger the save when my main delegate receives:
- (void)applicationWillTerminate:(UIApplication *)application
You should save in applicationDidEnterBackground:
, not applicationWillTerminate:
. When an app in the background is closed, it is killed without sending applicationWillTerminate:
(this is the SIGKILL you are getting). However, if you are supporting devices or versions without multitasking, you will need to save in applicationWillTerminate:
also, since it is used in those circumstances.
精彩评论