1

I have app that sometimes crashes in navigating through Navigation bar and in console log is no error except this ->

(lldb)

How can I check where is error?

Mayur Birari
  • 5,837
  • 8
  • 34
  • 61
iWizard
  • 6,816
  • 19
  • 67
  • 103
  • First step would be adding global breakpoints to have your debugger stop upon exception throw. See this tread http://stackoverflow.com/questions/6825275/how-do-you-add-a-global-breakpoint-in-xcode-4 – Vlad May 10 '12 at 14:09

4 Answers4

6

In Xcode, go to Product > Edit Scheme > Diagnostics > Enable Zombie Object

Now run the app and check the console.

defactodeity
  • 714
  • 1
  • 8
  • 21
  • Excellent, that's it. Now It shows me exactly where the error was. Is it okay if I leave it on at all the time? – iWizard May 10 '12 at 14:14
  • Since turning on Zombies means the memory zone occupied by the object will never get freed, there will be huge drag on the memory allocation. Therefore it's okay to use it when debugging, but you don't want to ship your product with this setting. – defactodeity May 10 '12 at 16:05
3

try enable zombie objects from

produt>edit schems> enable zombi

Saad
  • 8,857
  • 2
  • 41
  • 51
  • Excellent, that's it. Now It shows me exactly where the error was. Is it okay if I leave it on at all the time? – iWizard May 10 '12 at 14:15
  • yea ok but not when u deploy app to appstore – Saad May 10 '12 at 14:17
  • and more prefferabley never on a device, because this will aslo keep the relaesed objects in memory. that's y avoid it enabled when u want to deploy it into a device of sending it to appstore – Saad May 10 '12 at 14:18
3

See a recent answer I posted here:

When the debugger stops, go to the "Debug Navigator" and make sure the slider on the bottom is all the way to the right.

Scan your eye down from the point at which the exception is thrown and you should eventually come to your own code. Click on the appropriate method/function name and the code will be opened in the editor.

enter image description here

enter image description here

If you don't see any of your own methods in the stack trace, the exception may have been passed through a performSelector-style call in which case the stack trace is gone. If this is the case, you may get better information by adding an "On Throw" exception break point. First switch to the "Breakpoint navigator":

enter image description here

Then click on the plus and choose "Add Exception breakpoint..."

enter image description here

Create an "On Throw" break point:

enter image description here

This will stop the debugger at the exact point the exception is thrown, and you get a better stack trace. It's a good idea to have an exception break point like this enabled all the time.

Community
  • 1
  • 1
Mike Weller
  • 45,401
  • 15
  • 131
  • 151
2

Type bt at the lldb prompt and it will give you a stack trace telling where the app crashed.

Kirby Todd
  • 11,254
  • 3
  • 32
  • 60