偶尔,我发现崩溃来自-dealloc
中的SPTrack
:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xb1e8ded2
Crashed Thread: 13
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_c.dylib 0x39bb8d5c memset$VARIANT$CortexA9 + 100
1 CoreFoundation 0x35e1a7fc __CFAllocateObjectArray + 176
2 CoreFoundation 0x35d62118 _CFXNotificationRemoveObservers + 420
3 Foundation 0x33834490 -[NSNotificationCenter removeObserver:name:object:] + 228
4 MyAppName 0x00179fd0 -[SPTrack dealloc] (SPTrack.m:291)
5 MyAppName 0x0017993a __destroy_helper_block_141 (SPTrack.m:223)
6 libsystem_blocks.dylib 0x352adab0 _Block_release + 220
7 libdispatch.dylib 0x34b064b4 _dispatch_client_callout + 20
8 libdispatch.dylib 0x34b0b1b8 _dispatch_main_queue_callback_4CF$VARIANT$mp + 220
9 CoreFoundation 0x35de9f36 __CFRunLoopRun + 1286
10 CoreFoundation 0x35d5ceb8 CFRunLoopRunSpecific + 352
11 CoreFoundation 0x35d5cd44 CFRunLoopRunInMode + 100
12 GraphicsServices 0x362992e6 GSEventRunModal + 70
13 UIKit 0x3713b2fc UIApplicationMain + 1116
14 MyAppName 0x0005e986 main (main.m:14)
15 MyAppName 0x0001d8e4 start + 36
这是SPTrack
中#291的内容:
[[NSNotificationCenter defaultCenter] removeObserver:self name:SPSessionDidUpdateMetadataNotification object:self.session];
当我从后台带回应用程序时,通常会发生这种情况。
任何关于原因可能是什么的想法?是否试图不止一次地移除观察者?或self.session
无效? (无法用调试器捕获它。)