解释iOS崩溃报告

我遇到了多次崩溃,看起来本机iOS方法正在调用来自第三方库的函数.这是一个例子:

Thread: Unknown Name (Crashed)
0     libsystem_kernel.dylib                0x33222350 __pthread_kill + 8 + 8
1     libsystem_c.dylib                     0x3500f973 abort + 95 + 94
2     libsystem_c.dylib                     0x34ff04d1 basename + 1
3     FireChat                              0x00036489 -[OTOverlayButton drawRect:] + 1
4     Foundation                            0x37a4a5a9 -[NSDictionary(NSKeyValueCoding) valueForKey:] + 33 + 32
5     FireChat                              0x709d -[NetworkModel getUserForUid:] (NetworkModel.m:150)
6     FireChat                              0x0001c42f -[OpenTokController session:didReceiveStream:] (OpenTokController.m:258)
7     libdispatch.dylib                     0x32da011f _dispatch_call_block_and_release + 11 + 10
8     libdispatch.dylib                     0x32d9f4b7 _dispatch_client_callout + 23 + 22
9     libdispatch.dylib                     0x32da41bd _dispatch_main_queue_callback_4CF$VARIANT$mp + 225 + 224
10   CoreFoundation                         0x37dbbf3b __CFRunLoopRun + 1291 + 1290
11   CoreFoundation                         0x37d2eebd CFRunLoopRunSpecific + 357 + 356
12   CoreFoundation                         0x37d2ed49 CFRunLoopRunInMode + 105 + 104
13   GraphicsServices                       0x358e22eb GSEventRunModal + 75 + 74
14   UIKit                                  0x3a1b42f9 UIApplicationMain + 1121 + 1120
15   FireChat                               0x43b3 main (main.m:8)

对我来说,似乎[NSDictionary valueForKey:]方法正在调用来自第三方库的[OTOverlayButton drawRect:].这不应该是可能的 – 我是否错误地阅读了崩溃报告?

在我的代码中的任何地方都没有调用[OTOverlayButton drawRect:].请注意,字典包含(my)对象,这些对象包含指向第三方库中对象的指针.

图书馆供应商和我都感到困惑.

谢谢.

最佳答案 我相信这次崩溃的原因是在返回结构的方法上调用performSelector:导致内存损坏.有关详细信息,请参阅此博客文章:

Why performSelector is more dangerous than I thought

点赞