我正在开发一款通用应用程序,iPhone版本运行正常。我为iPad创建了一个新的笔尖,并将文件所有者设置为viewcontroller类。我连接了所有IBOutlets和IBActions。当我在iPad(以及iPad模拟器)上运行应用程序时,当我触摸任何控件时它会崩溃。我尝试在每个IBActions中设置断点,但它甚至没有发生在崩溃发生之前。发生了什么事?
回溯:
*线程#1:tid = 0x1f03,0x0189809b libobjc.A.dylib objc_msgSend + 15, stop reason = EXC_BAD_ACCESS (code=2, address=0x15)
frame #0: 0x0189809b libobjc.A.dylib
objc_msgSend + 15
帧#1:0x0020f14e UIKit -[UIApplication sendAction:to:from:forEvent:] + 96
frame #2: 0x0020f0e6 UIKit
- [UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
帧#3:0x002b5ade UIKit -[UIControl sendAction:to:forEvent:] + 66
frame #4: 0x002b5fa7 UIKit
- [UIControl(内部)_sendActionsForEvents:withEvent:] + 503
帧#5:0x002b5b13 UIKit -[UIControl sendActionsForControlEvents:] + 48
frame #6: 0x00304462 UIKit
- [UISegmentedControl _setSelectedSegmentIndex:notify:] + 684
帧#7:0x00305dd0 UIKit -[UISegmentedControl touchesBegan:withEvent:] + 1026
frame #8: 0x002342cf UIKit
- [UIWindow sendTouchesForEvent:] + 272
帧#9:0x002345e6 UIKit -[UIWindow sendEvent:] + 273
frame #10: 0x0021adc4 UIKit
- [UIApplication sendEvent:] + 464
帧#11:0x0020e634 UIKit _UIApplicationHandleEvent + 8196
frame #12: 0x021c0ef5 GraphicsServices
PurpleEventCallback + 1274
帧#13:0x012a1195 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
frame #14: 0x01205ff2 CoreFoundation
_CFRunLoopDoSource1 + 146
帧#15:0x012048da CoreFoundation __CFRunLoopRun + 2218
frame #16: 0x01203d84 CoreFoundation
CFRunLoopRunSpecific + 212
帧#17:0x01203c9b CoreFoundation CFRunLoopRunInMode + 123
frame #18: 0x021bf7d8 GraphicsServices
GSEventRunModal + 190
帧#19:0x021bf88a GraphicsServices GSEventRun + 103
frame #20: 0x0020c626 UIKit
UIApplicationMain + 1163
帧#21:0x00001d8d gravity`main + 141 at main.m:16
答案 0 :(得分:2)
由于ARC,视图控制器未被保留。所以,当我回去向它发送消息时,它就崩溃了。