【发布时间】:2012-03-17 18:55:37
【问题描述】:
我正在开发一个通用应用程序,iPhone 版本运行良好。我为 iPad 创建了一个新的 nib,并将文件所有者设置为 viewcontroller 类。我连接了所有的 IBOutlets 和 IBActions。当我在 iPad(和 iPad 模拟器)上运行该应用程序时,当我触摸任何控件时它会崩溃。我尝试在 IBActions 中为每个设置断点,但它甚至没有在崩溃发生之前设置断点。怎么回事?
回溯:
* 线程#1:tid = 0x1f03, 0x0189809b libobjc.A.dylibobjc_msgSend + 15, stop reason = EXC_BAD_ACCESS (code=2, address=0x15)
frame #0: 0x0189809b libobjc.A.dylibobjc_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(Internal) _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 GraphicsServicesPurpleEventCallback + 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 CoreFoundationCFRunLoopRunSpecific + 212
第 17 帧:0x01203c9b CoreFoundationCFRunLoopRunInMode + 123
frame #18: 0x021bf7d8 GraphicsServicesGSEventRunModal + 190
帧 #19:0x021bf88a GraphicsServicesGSEventRun + 103
frame #20: 0x0020c626 UIKitUIApplicationMain + 1163
第 21 帧:0x00001d8d 重力`main + 141 at main.m:16
【问题讨论】:
-
您收到的错误信息是什么?
-
没有,它只是在 main.m 中崩溃。如果有什么不同,我会使用 lldb。
-
如果调试器在您的 main.m 文件中的 UIApplicationMain 处停止,这通常是由于异常 - 您会在调试控制台中找到有关异常的详细信息。
-
控制台崩溃时不打印任何内容,但查看回溯问题。
-
如果能贴出一些实际代码,有助于我们分析错误。