偶尔,我看到来自SPTrack
-dealloc
的崩溃:
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
这是 #291 在 SPTrack
上的内容:
[[NSNotificationCenter defaultCenter] removeObserver:self name:SPSessionDidUpdateMetadataNotification object:self.session];
当我从后台恢复应用程序时,通常会发生这种情况。
对原因可能是什么有什么想法吗?它是否试图多次删除观察者?还是self.session
无效?(无法使用调试器捕获它。
在CocoaLibSpotify中挑选了这个提交之后(根据iKenndac的建议),我不再遇到这些崩溃。