App crashes with error “Thread 1: signal SIGKILL” when I start it up the second time in the simulator. The first time it will work perfectly, but if I close the app completely (double tapping the home button and closing the app) and start it up again – it crashes.
I found others having the same problem (app crashes second time), but not of the same cause.
I tried creating a new project to isolate the error, and it happens when I’m trying to programmatically load a ViewController.
I have made two simple classes: MainView and Loader (which is supposed to load MainView).
In the viewDidAppear method in the Loader class I have the following code:
[super viewDidAppear:YES];
sleep(1); //Simulating to be doing stuff
MainView* mainView = [self.storyboard instantiateViewControllerWithIdentifier:@"MainView"];
[self presentViewController:mainView animated:YES completion:nil];
I get the following backtrace:
* thread #1: tid = 0x1f03, 0x9b5f5c22 libsystem_kernel.dylib`mach_msg_trap + 10, stop reason = signal SIGKILL
frame #0: 0x9b5f5c22 libsystem_kernel.dylib`mach_msg_trap + 10
frame #1: 0x9b5f51f6 libsystem_kernel.dylib`mach_msg + 70
frame #2: 0x0139b10a CoreFoundation`__CFRunLoopServiceMachPort + 186
frame #3: 0x012fe550 CoreFoundation`__CFRunLoopRun + 1312
frame #4: 0x012fdd84 CoreFoundation`CFRunLoopRunSpecific + 212
frame #5: 0x012fdc9b CoreFoundation`CFRunLoopRunInMode + 123
frame #6: 0x012b07d8 GraphicsServices`GSEventRunModal + 190
frame #7: 0x012b088a GraphicsServices`GSEventRun + 103
frame #8: 0x00011626 UIKit`UIApplicationMain + 1163
frame #9: 0x00001c4d progLoadingTest`main + 141 at main.m:16
frame #0: 0x9b5f5c22 libsystem_kernel.dylib`mach_msg_trap + 10
frame #1: 0x9b5f51f6 libsystem_kernel.dylib`mach_msg + 70
frame #2: 0x0139b10a CoreFoundation`__CFRunLoopServiceMachPort + 186
frame #3: 0x012fe550 CoreFoundation`__CFRunLoopRun + 1312
frame #4: 0x012fdd84 CoreFoundation`CFRunLoopRunSpecific + 212
frame #5: 0x012fdc9b CoreFoundation`CFRunLoopRunInMode + 123
frame #6: 0x012b07d8 GraphicsServices`GSEventRunModal + 190
frame #7: 0x012b088a GraphicsServices`GSEventRun + 103
frame #8: 0x00011626 UIKit`UIApplicationMain + 1163
frame #9: 0x00001c4d progLoadingTest`main + 141 at main.m:16
I found out that this is normal behavior for any app that you close in the emulator and then start again in the emulator. I just coincidentally happened to be loading a ViewController. As such it really is not a crash.