问题
I was experimenting with my app in the ios simulator when I found that it produces the SIGKILL signal when I delete it from the multitasking bar and then rerun it. (I do this by stopping the app, running another app, then deleting the first app from the multitasking bar and rerunning it.)
I thought this might have something do do with my latest experiment, adding Core Data, but after trying to simplify the conditions, it looks like it is happening withe every app I test it with.
The code stops in the debugger at the point identified by my comment:
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil); //<- STOPS with SIGKILL here
[pool release];
return retVal;
}
I also found that it appears to be halting as if it is a break point. I click the continue button, and it resumes as if nothing happened. I put a real break point at the marked line and it halts there. Clicking continue lets the program resume without the SIGKILL signal occurring.
I tried this with a basic template program for Core Data, with no modifications of my own, and the signal occurs. I tried it with other programs that do not use Core Data, and the signal occurs. I tried it when the program is already loaded but not being debugged, and the program behaves properly, even though the problem occurs when it is being debugged.
Of course, SIGKILL does not give any error message that help.
Does anyone know what is happening? It doesn't seem like a real problem, but I want to make sure I understand it.
I am using XCODE4.
回答1:
Deleting the program from the multitasking bar stops it from running. It's the equivalent of the "Force Quit" option you get in OS X when right-clicking an application icon in the dock.
At the iOS level, this is apparently done by sending the "kill" signal, known as SIGKILL, to the application.
来源:https://stackoverflow.com/questions/5606158/ios-simulator-sigkill