Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 539
Tim Avatar asked Nov 03 '11 18:11

Tim


People also ask

How do I debug iOS simulator app?

Inspect the page. In the Safari on your Mac, on the Safari menu bar, choose the "Develop" menu. Scroll to the iOS Simulator option. Select the page for debugging.

Why does my app keep crashing iOS?

When your apps keep crashing on your iPhone, updating them may just be the trick to solving it. To quickly check whether a specific app has an update, go to the App Store's Search tab to find the app. If an update is available, you'll see an Update button instead of the usual Open button. Tap on it to update the app.

Does iOS simulator use GPU?

Simulator doesn't try to exactly simulate the GPU from the iOS or tvOS device you are simulating. For example, if you are simulating the iPhone XS, Simulator does not try to emulate the capabilities of an A12 GPU. Instead, Simulator translates any calls you make and directs them to the selected GPU on the host Mac.


1 Answers

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.

like image 116
Oliver Avatar answered Sep 30 '22 15:09

Oliver