Stack traces in Xcode 4.1+

Guides | Tutorial By 6 years ago

Since Xcode 4.1 when your application throws an exception your console just prints a list of function pointers and you don’t get a proper stack trace. This isn’t helpful if you’re trying to find the exact line the error occurred on.

2012-03-18 00:01:17.028 Testing[16575:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[testAppDelegate crash]: unrecognized selector sent to instance 0x6d13ae0'
*** First throw call stack:
(0x13c7022 0x1558cd6 0x13c8cbd 0x132ded0 0x132dcb2 0x20b3 0xf386 0x10274 0x1f183 0x1fc38 0x13634 0x12b1ef5 0x139b195 0x12ffff2 0x12fe8da 0x12fdd84 0x12fdc9b 0xfc65 0x11626 0x1da2 0x1d15)
terminate called throwing an exception

There’s a really easy way to solve this, but it’s not very obvious. In your breakpoint navigator (push Command + 6) click the little + down the bottom left hand side. Add an exception breakpoint and you’re done. The next time an exception is thrown, the breakpoint will stop on the problem line, and you get a proper stack trace in your debug navigator.

  • TutLeGrand

    thank you ! it saves my life !! 🙂

  • made my day 🙂 thx