Xcode - showing a stack trace when iPhone apps crash
August 25, 2009
By default, when your iPhone app crashes xcode does not show you where
exactly that crash occurred. Generally you just get a call stack of
functions with names that mean very little to most people, and are rewarded with lovely disassembly if you click on
any of them. You do get a description of the error, but as it doesn't actually
tell you where it error came from it's often not that helping in
finding the offending code.
Luckily there's a drop-dead simple method of getting xcode to show you the 'proper' stack trace..
- Go to the debugger window, click the 'breakpoints' window.
- Double-click where it says 'double-click for symbol' and type objc_exception_throw. This'll add a new exception whenever the objc_exception_throw function is called - e.g. when an exception is thrown.
Now when your app inevitably crashes, you can actually see the stack trace leading to where the exception occurs. Huzzah!
Now, why on earth would that not be enabled by default? Answers on a postcard please :-)
