Reputation: 445
Alright this is a strange one that is absolutely filling up my crash logs, and I just can't figure it out. Looking at the trace, it looks like [UIApplication _terminateWithStatus:]
is called, and then NSNotificationCenter tries to post a notification. appWillTerminate is called on an object that doesn't respond to it. This object appears to vary, so it seems like a zombie.
Here's my two big problems. First, I can't seem to reproduce this! My crash reporter even saves the userID of the user, so I know it's happened to me and my coworkers, but I've never seen the app actually crash and they said they hadn't observed it either, even though the crash log is there. Secondly, it's happening a lot. Thousands of these are coming in a week. I don't really have any specific complaints, but it's making me nervous. Is the app crashing as it closes? How can I find out what's causing this? I can't find any listeners for "NSApplicationWillTerminateNotification" in my code except for MixPanel, Facebook, and CocoaLumberjack. I've gone through and double checked that all observers are removed. I'm stumped.
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x157edd10
Crashed Thread: 0
Application Specific Information:
objc_msgSend() selector name: appWillTerminate:
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000199379bd0 objc_msgSend + 16
1 CoreFoundation 0x000000018471a6ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 16
2 CoreFoundation 0x0000000184719ecc _CFXRegistrationPost + 392
3 CoreFoundation 0x0000000184719c4c ___CFXNotificationPost_block_invoke + 56
4 CoreFoundation 0x000000018477f434 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1528
5 CoreFoundation 0x000000018465a834 _CFXNotificationPost + 364
6 Foundation 0x00000001855c62fc -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
7 UIKit 0x0000000189d59590 -[UIApplication _terminateWithStatus:] + 332
8 UIKit 0x0000000189f716d0 __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke1976 + 312
9 UIKit 0x0000000189f74844 _runAfterCACommitDeferredBlocks + 288
10 UIKit 0x0000000189f80de4 _cleanUpAfterCAFlushAndRunDeferredBlocks + 88
11 UIKit 0x0000000189cbd1e4 _afterCACommitHandler + 92
12 CoreFoundation 0x000000018472bc30 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
13 CoreFoundation 0x00000001847299d4 __CFRunLoopDoObservers + 368
14 CoreFoundation 0x0000000184729e04 __CFRunLoopRun + 924
15 CoreFoundation 0x0000000184658dc0 CFRunLoopRunSpecific + 380
16 GraphicsServices 0x000000018f7ac088 GSEventRunModal + 176
17 UIKit 0x0000000189d32f60 UIApplicationMain + 200
18 Redacted 0x00000001000d700c main (main.m:11)
19 libdyld.dylib 0x0000000199b928b8 start + 0
Upvotes: 0
Views: 2043
Reputation: 7287
This would happen if a class would subscribe to a notification, and not unsubscribe before deallocating.
Use the Zombies Instrument to debug this scenario. It will tell you what the offending class is.
Upvotes: 1