How do I find out what exception was thrown in the Xcode debugger (for iPhone)? How do I find out what exception was thrown in the Xcode debugger (for iPhone)? xcode xcode

How do I find out what exception was thrown in the Xcode debugger (for iPhone)?


Put a breakpoint at objc_exception_throw and run your app via Debug instead of Run

To clarify, what you're actually seeing when you get an exception without the breakpoint is the same stack trace always - it's the uncaught exception handler. The type of exception is logged to the Run console, but if you want to see a backtrace for where the exception was raised, that's what the breakpoint is for.


In the new Xcode (at least starting from v4.5), you can catch all exceptions easily by doing this:

  1. Bring up breakpoint navigator (⌘6)
  2. Click + on the bottom left
  3. Add Exception Breakpoint

I think the above is the same as a breakpoint on objc_exception_throw. http://samwize.com/2012/09/26/xcode-4-dot-5-tips-and-tricks/


http://ijoshsmith.com/2011/11/28/debugging-exceptions-in-xcode-4-2/

Same as samewize's solution, but also shows how to make this breakpoint show up by default in all your projects (right click on breakpoint, Move Breakpoint To, User).