How to track the exact issue for the crash in iOS
Asked Answered
C

4

5

When I was debugging my iPhone app, I got an error and the app got crashed. I have added a exception break point but it didn't point any where in the code and crashed in main.m.

Here I am adding the screen shot of the XCode window when the app crashed.

enter image description here How can I find the exact issue for the crash from this?

Is it possible? Please help.

Crispen answered 4/3, 2013 at 10:35 Comment(3)
Me too had this kind of issues, but I couldn't find anyway to find the exact issue. I would appreciate if anyone can point out any possible way here. :)Taps
If you have some codes in your program kindly show them. So that soomeone can reach to error point.Obsequious
I afraid which part of my code caused this issue, I was randomly navigating through different VCs, suddenly I got this issue. And also, in the debug window it didn't mention any code or function. What should I do in this case?Crispen
P
6

Enable Zoombie so that you will get the error description in log.

If you edit the scheme you want to turn on zombies for (in the "Product" menu, select "Edit Scheme"), go to the "Run Foo.app" stage in the left panel, and the "Arguments" tab on the right. You can then add NSZombieEnabled to the "Environment Variables" section and set the value to YES, as you could in Xcode 3.

In Xcode 4.1 and above, there's also checkbox on the "Diagnostics" tab of the "Run" stage to "Enable Zombie Objects".

Psychologist answered 4/3, 2013 at 10:42 Comment(2)
Sorry, actually I forgot add the second option, now enabled that too. Thanks :)Crispen
I changed the settings as you mentioned and tested. I got the crash issue again but it didn't show me any details.Crispen
C
6

click on EditScheme in XCode. then screen will be show like below. click on Enable Zombie Objects.It will shows error on your log.

enter image description here

Carport answered 4/3, 2013 at 10:44 Comment(3)
Thank you, actually I forgot that option there, will enable it and try again.Crispen
Sorry, I think Melbourne said the same answer before you did, so I should accept his answer right? Don't worry I gave you a Upvote and I really appreciate for your help with the exact screen shot, it was much easy to understand. Thanks :)Crispen
@Mithuzz. This is not only for you.so many programmers will try to understand the correct answer.giving screen shot is more acceptable answer for this type question. we have to give a better route to new programmers.Carport
A
3

Add an Exception breakpoint and the debugger will stop on the line that crashes.

Alcott answered 4/3, 2013 at 10:37 Comment(1)
I already did that, it was pointing for some other issues, but when this error occur, nothing happened. Is it possible to find the issue from the Debug Navigator window?Crispen
G
1

Not sure but reading the registers might help.

First go to Exceptions tab and 'Add Exception Breakpoint' using the + at the bottom left corner. enter image description here

Then when the app crashes click on "0 objc_exception_throw" under Thread 1 enter image description here

Finally in the console enter:

  • register read (you should get a list of registers)

  • po $rax (normally the exception is in 'rax')

    (you should see the exception output on the console)

Hope this helps.

Gough answered 8/5, 2014 at 12:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.