使用iOS Simulator&进行调试应用程序崩溃XCode 4在main()函数中暂停,而不是崩溃源 [英] Debugging app crashes with iOS Simulator & XCode 4 halts in main() function, not crash source

查看:75
本文介绍了使用iOS Simulator&进行调试应用程序崩溃XCode 4在main()函数中暂停,而不是崩溃源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
Xcode 4.2显示错误的错误代码行

Possible Duplicate:
Xcode 4.2 showing the wrong line of code on error

Xcode 4的调试器似乎没有在iOS Simulator崩溃原因附近的任何地方停止执行.假设我在代码中引入了一个错误,也许是一个数组超出范围的错误,如下所示:

Xcode 4's debugger doesn't seem to halt execution anywhere near the causes of crashes in iOS Simulator. Say I introduce a bug in my code, perhaps an array out of bounds error like this:

NSMutableArray * test = [[NSMutableArray alloc] initWithCapacity:5];
[test insertObject:@"Hello" atIndex:10];

当应用程序不可避免地崩溃时,我被带到main.m中的main函数,而调用堆栈上没有任何内容(按线程"视图)来帮助我找出问题所在.

When the app inevitably crashes, I'm taken to the main function in main.m with nothing on the call stack (the 'By Thread' view) to help me find what went wrong.

也许在构建属性中缺少调试设置吗?如果有帮助,这是Snow Leopard上的Xcode 4.2.

Is there a debugging setting I'm missing in the build properties, perhaps? This is Xcode 4.2 on Snow Leopard if it helps.

谢谢

推荐答案

转到断点面板,然后添加左下角的内容,单击+号并添加"Exception breakpoint".

Go to the breakpoints panel, and add the bottom left, click the + sign and add an "Exception breakpoint".

例外:全部
休息:投掷.

Exceptions : All
Break : On throw.

在大多数情况下,这应该可以解决问题.

That should solve the problem in most cases.

这篇关于使用iOS Simulator&进行调试应用程序崩溃XCode 4在main()函数中暂停,而不是崩溃源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆