iOS 8崩溃 - objc_msgSend()选择器名称:respondsToSelector:

Zia*_*Zia 1 objc-message-send ios8

我有以下崩溃报告.它只发生在iOS 8上.我确切知道如何重现它,但不能在我的生活中找出问题在我的代码中的位置.当我使用断点并尝试单步执行应用程序时,崩溃不会发生.如何在我的应用中找到问题所在?

Exception Type:  SIGSEGV
Exception Codes: SEGV_ACCERR at 0x10
Crashed Thread:  0

    Application Specific Information:
objc_msgSend() selector name: respondsToSelector:

Thread 0 Crashed:
0   libobjc.A.dylib                      0x00000001974b3bd0 objc_msgSend + 16
1   UIKit                                0x000000018ab960f4 -[UIToolbar _didMoveFromWindow:toWindow:] + 108
2   UIKit                                0x000000018aa30d44 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 700
3   UIKit                                0x000000018aa30d44 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 700
4   UIKit                                0x000000018aa30d44 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 700
5   UIKit                                0x000000018aa303dc __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 140
6   UIKit                                0x000000018aa302bc -[UIView(Hierarchy) _postMovedFromSuperview:] + 480
7   UIKit                                0x000000018aa3c0b0 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1788
8   UIKit                                0x000000018ac1c368 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1432
9   UIKit                                0x000000018aa42b6c +[UIView(Animation) performWithoutAnimation:] + 84
10  UIKit                                0x000000018ac1bb2c -[_UINavigationParallaxTransition animateTransition:] + 852
11  UIKit                                0x000000018abd7b70 -[UINavigationController _startCustomTransition:] + 3032
12  UIKit                                0x000000018aae9ef0 -[UINavigationController _startDeferredTransitionIfNeeded:] + 464
13  UIKit                                0x000000018aae9cbc -[UINavigationController __viewWillLayoutSubviews] + 52
14  UIKit                                0x000000018aae9c3c -[UILayoutContainerView layoutSubviews] + 196
15  UIKit                                0x000000018aa31760 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 576
16  QuartzCore                           0x000000018a379e1c -[CALayer layoutSublayers] + 148
17  QuartzCore                           0x000000018a374884 CA::Layer::layout_if_needed(CA::Transaction*) + 316
18  QuartzCore                           0x000000018a374728 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 28
19  QuartzCore                           0x000000018a373ebc CA::Context::commit_transaction(CA::Transaction*) + 272
20  QuartzCore                           0x000000018a373c3c CA::Transaction::commit() + 524
21  QuartzCore                           0x000000018a36d364 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 76
22  CoreFoundation                       0x0000000185fac2a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
23  CoreFoundation                       0x0000000185fa9230 __CFRunLoopDoObservers + 356
24  CoreFoundation                       0x0000000185fa9610 __CFRunLoopRun + 832
25  CoreFoundation                       0x0000000185ed52d4 CFRunLoopRunSpecific + 392
26  GraphicsServices                     0x000000018f59b6fc GSEventRunModal + 164
27  UIKit                                0x000000018aa9afac UIApplicationMain + 1484
28  MyAppName                            0x00000001001b8ae0 main (main.m:16)
29  libdyld.dylib                        0x0000000197b1ea08 start + 0
Run Code Online (Sandbox Code Playgroud)

mat*_*att 13

我确切知道如何重现它

仅凭这一点就值得用黄金来衡量.

这是一个内存管理问题.你需要在僵尸打开的情况下复制崩溃的条件.有些对象已经从指针下面消失了,僵尸会告诉你它是什么对象.

请记住,崩溃的时刻可能与问题的原因无关.崩溃的时刻只是诊断.消失的物体很可能早已消失; 但是,现在才有人试图向它发送消息,却发现它不再是家.

(例如,一个带有a delegate和其委托已被销毁的Cocoa类会导致这种问题.委托不会保留,所以Cocoa类不知道发生了什么.解决方案就是你需要的设置delegatenil之前委托出去的存在我不是说这是具体问题;我只是给人这样的事情是如何发生的一个例子)