1

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 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

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.