I'm trying to figure out why an app I'm developing has started crashing immediately when running it on my device (an iPhone 4 running iOS 6.1). I have been working on this app for about 8 weeks and this problem has arisen seemingly out of the blue.
The app runs fine when I run it on the simulator. When I try to run it on my device it crashes, and breaks at:
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
The crash happens before the AppDelegate method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
gets called.
I have looked at the device crash log, and I don't see anything that gave me a clue as to what is happening. Does anyone have an idea of where I can start looking for a solution? For what it's worth, here is the crash log:
Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x39e74350 __pthread_kill + 8 1 libsystem_c.dylib 0x39deb11e pthread_kill + 54 2 libsystem_c.dylib 0x39e2796e abort + 90 3
GraphicsServices 0x357da9ce GSRegisterPurpleNamedPort + 210 4 GraphicsServices 0x357da684 _GSEventInitialize + 92 5 UIKit 0x33b2d0c8 UIApplicationMain + 552 6 CK-Ranker 0x000bbaf4 main (main.m:16) 7
CK-Ranker 0x000bba7c start + 36Thread 1: 0 libsystem_kernel.dylib 0x39e74d98 __workq_kernreturn + 8 1 libsystem_c.dylib 0x39dc2cf6 _pthread_workq_return + 14 2 libsystem_c.dylib 0x39dc2a12 _pthread_wqthread + 362 3 libsystem_c.dylib
0x39dc28a0 start_wqthread + 4Thread 2 name: Dispatch queue: com.apple.libdispatch-manager Thread 2: 0 libsystem_kernel.dylib 0x39e64648 kevent64 + 24 1
libdispatch.dylib 0x39d9d4ec _dispatch_mgr_invoke + 792 2 libdispatch.dylib 0x39d8fdf4 _dispatch_mgr_thread$VARIANT$up + 32Thread 3: 0 libsystem_kernel.dylib 0x39e74d98 __workq_kernreturn + 8 1 libsystem_c.dylib 0x39dc2cf6 _pthread_workq_return + 14 2 libsystem_c.dylib 0x39dc2a12 _pthread_wqthread + 362 3 libsystem_c.dylib
0x39dc28a0 start_wqthread + 4Thread 4 name: WebThread Thread 4: 0 libsystem_kernel.dylib
0x39e63eb4 mach_msg_trap + 20 1 libsystem_kernel.dylib
0x39e64048 mach_msg + 36 2 CoreFoundation
0x31ca6040 __CFRunLoopServiceMachPort + 124 3 CoreFoundation
0x31ca4d9e __CFRunLoopRun + 878 4 CoreFoundation
0x31c17eb8 CFRunLoopRunSpecific + 352 5 CoreFoundation
0x31c17d44 CFRunLoopRunInMode + 100 6 WebCore
0x37c16500 RunWebThread(void*) + 440 7 libsystem_c.dylib
0x39dcd30e _pthread_start + 306 8 libsystem_c.dylib
0x39dcd1d4 thread_start + 4Thread 0 crashed with ARM Thread State (32-bit): r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x3b92d534 r4: 0x00000006 r5: 0x3b92db88 r6: 0x3b933ff4 r7: 0x2fd46c48 r8: 0x1ed7a570 r9: 0x001844f0 r10: 0x00000000 r11: 0x00000000 ip: 0x00000148 sp: 0x2fd46c3c lr: 0x39deb123 pc: 0x39e74350 cpsr: 0x00000010
I am running Xcode 4.6.1 with ARC enabled.
You need to give some more code or tell what does your app do on startup.
But its clear from the crash logs that the
Thread0
that main UI thread has been killed. This could be because on device there is a process calledwatchdog
, it kills any processes which seem dubious. like take too much memory or take take too much time to show first screen on app startup & other things which "Apple" thinks would affect user experience. So...As it turns out there was a problem with my device. I reset my device and the crash disappeared. In future I'll be sure to remember to try resetting my device when I run into this crash.