Exception Breakpoint in Xcode


In Xcode 4 when an exception is raised (wether it is ,unrecognized selector sent to instance‘ exception or an 'out of bounds' exception or another exception) the exception goes up the call stack looking for someone who can handle it. And what normally happens is that no on handles it  and the exception percolate up the call stack all the way up to main. The program just crashes and you lost the call stack information.
To avoid this, Xcode provides a very important breakpoint which gonna break every time an exception is raised and Xcode shows in the main code window the line of code on which that exception would raise.


You can add an Exception Breakpoint by opening the Breakpoint Navigator.


Breakpoint Navigator

Than you have to click the Plus Button in bottom left corner:

Add Exception Breakpoint

After clicking Add Exception Breakpoint menu item, you will see this breakpoint configuration view open up:

Click Done
After clicking the Done button and you will the new Exception Breakpoint in your list of breakpoints.

I recommend setting that exception on all the time on in Xcode because you pretty much always want to have this exception happen right a the line of code.