Debugging app crashes with iOS Simulator & XCode 4 halts in main() function, not crash source [duplicate]

假装没事ソ 提交于 2019-12-06 02:16:08

问题


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

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];

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.

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

Thanks


回答1:


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.




回答2:


Adding an Exception breakpoint in Breakpoint Navigator per this question's accepted answer - Xcode 4.2 debug doesn't symbolicate stack call - fixes the issue.



来源:https://stackoverflow.com/questions/8000139/debugging-app-crashes-with-ios-simulator-xcode-4-halts-in-main-function-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!