【发布时间】:2011-12-23 04:11:25
【问题描述】:
升级到 XCode4 (v. 4.2, 4D199) 后,似乎每次我的应用程序在调试时崩溃,调试指向 main(),并且堆栈是非符号化且无用的。
多年来一直运行良好,我不知道出了什么问题。
我正在使用 GDB。我还按照this advice 尝试了 LLDB,但它也没有工作(类似的,无用的堆栈)。
我的断点工作,我得到了完整的堆栈,并且可以在我的代码遇到这些时检查变量。
重现步骤:
注意。这发生在我自己的项目中,但我将在此处使用 Apple 的代码从等式中删除该变量
从 Apple 下载以下示例:https://developer.apple.com/library/ios/#samplecode/UICatalog/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007710
-
在
ImagesViewController类中,将以下代码添加到viewDidLoad方法中(这样它就会崩溃——我们希望它在这个测试中崩溃):// please note: this code is designed to crash! I want it to crash, to highlight my issue with XCode. NSMutableArray* test = [NSMutableArray new]; [test insertObject:NULL atIndex:0]; 然后运行应用程序并点击“图片”行。
-
它崩溃并显示如下消息:
2011-12-23 14:07:02.788 UICatalog[13394:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil' *** First throw call stack: (0x37bbb8bf 0x316a11e5 0x37b1020f 0x699f 0x34fac7ff 0x34fb8c39 0x34fb8aa9 0x34fb898f 0x34fb815b 0x34fb7f53 0x34fac673 0x34fac349 0x66c1 0x35026565 0x3509ece7 0x31aec943 0x37b8fa63 0x37b8f6c9 0x37b8e29f 0x37b114dd 0x37b113a5 0x3768ffcd 0x34fa1743 0x2459 0x2418) terminate called throwing an exception(gdb)
在 xcode 中查看:
【问题讨论】:
-
Brigadir,该解决方案有效。非常感谢!
标签: ios xcode debugging xcode4 gdb