I have an application that when terminated needs to synchronize the content of a sqlite database.
To know when the application is terminating, I put a breakpoint in the app delegate’s applicationWillTerminate: method.But the debugger never steps there.
I know two methods to terminate the application:
- Like I do in the iPhone: Keep touching the application icon until it starts trembling, the I click on ‘x’;
- Stopping the debugger.
None of these two methods cause the debugger to step in the applicationWillTerminate: method of my app delegate.
If I use the first method I even get an exception: I receive SIGKILL right in this line:
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
It seems like the simulator launches SIGKILL even if there isn’t a handler for that signal.
The last message called is mach_msg_trap.
From the documentation
You probably want
applicationWillResignActive:.