Spend some time learning how to use Xcode's debugger, especially from the Console (Command-Shift-R). I also recommend making the Console come up any time you start your program from Xcode via Preferences(cmd-,)->Debugging->On Start->Show Console.
You can set a breakpoint that gets hit any time an exception is thrown by opening the breakpoint window (cmd-option-B) and double clicking "Double-Click For Symbol and entering objc_exception_throw
.
Any time you're stopped in the debugger, you can print the description for any object in scope by entering po objectname
or any primitive via p (type)primitivename
at the (gdb) prompt in the console. As an example, po self
any time you're stopped inside a method will print the description for the object containing the method, whereas p self
will print the pointer type and address for same.
You can even call methods on any object in scope this way, for example if there's a myobject
object which has a method with signature -(int)myMethod you can call it using p (int)[myObject myMethod]
. Great for dynamically debugging an issue.