UIKit -[UIApplication sendAction:to:from:forEvent:] 崩溃

10

我遇到了一个非常不寻常的问题...我的UIKit出现了崩溃...这是我第一次遇到这样的情况...请问有人能够指导我吗?

这是我得到的崩溃日志。

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x1161a18c

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x386fcb66 objc_msgSend + 5
1  UIKit                          0x30b5dda3 -[UIApplication sendAction:to:from:forEvent:] + 90
2  UIKit                          0x30cc5615 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 120
3  UIKit                          0x30b5dda3 -[UIApplication sendAction:to:from:forEvent:] + 90
4  UIKit                          0x30b5dd3f -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 38
5  UIKit                          0x30b5dd13 -[UIControl sendAction:to:forEvent:] + 46
6  UIKit                          0x30b49743 -[UIControl _sendActionsForEvents:withEvent:] + 374
7  UIKit                          0x30b5d75b -[UIControl touchesEnded:withEvent:] + 594
8  UIKit                          0x30b5d425 -[UIWindow _sendTouchesForEvent:] + 528
9  UIKit                          0x30b58451 -[UIWindow sendEvent:] + 832
10 UIKit                          0x30b2dd79 -[UIApplication sendEvent:] + 196
11 UIKit                          0x30b2c569 _UIApplicationHandleEventQueue + 7116
12 CoreFoundation                 0x2e36ff1f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
13 CoreFoundation                 0x2e36f3e7 __CFRunLoopDoSources0 + 206
14 CoreFoundation                 0x2e36dbd7 __CFRunLoopRun + 630
15 CoreFoundation                 0x2e2d8471 CFRunLoopRunSpecific + 524
16 CoreFoundation                 0x2e2d8253 CFRunLoopRunInMode + 106
17 GraphicsServices               0x330122eb GSEventRunModal + 138
18 UIKit                          0x30b8d845 UIApplicationMain + 1136
19 TradeMate                      0x0008f2bf main (main.m:16)

你是如何遇到这个错误的?请提供具体步骤,或者说明该错误是否在启动应用程序时出现。 - 2intor
这来得出乎意料.. 不知道我是怎么得到的... - Ahmed Z.
尝试使用异常断点 https://dev59.com/m2Mm5IYBdhLWcg3wMssp#17802942 - iCoder
我从我的客户设备上运行的应用程序获得了这份报告,但我无法在自己的设备上复现它,所以不能使用异常断点。 - Ahmed Z.
2
可能相关:IBACTION导致EXC_BAD_ACCESS错误 - Matthias Bauch
2个回答

7

您遇到了objc_msgSend崩溃。根据这篇著名文章的解释,这意味着接收器已经消失。在这种情况下,似乎用户点击了一个按钮,该按钮向目标发送一个动作消息,但目标对象已经不存在。


这个问题有什么解决方案? - Samkit Jain
即使你知道导致崩溃的原因,也很难定位到具体的代码行。这让我疯狂。在我的情况下,它只会发生在iOS8上,而且我们无法重现它。 - Grey

0

确保接收事件的接收器或对象被声明为强引用。 否则,您可能无法获取崩溃日志以找出问题所在 :)

enter image description here

如果你遇到了类似上述的问题,请检查对象是否被声明为strong。这应该可以解决问题。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接