how to debug EXC_CRASH (SIGTRAP)

You can also turn on Exception breakpoints. In XCode 4 click your project and choose the breakpoints tab. At the bottom of that tab is | + | - | search bar. Choose the + item and "Add Exeception Breakpoint". You can leave it at All or choose Objective-C. This way you will break in the debugger and be able to see what caused the exeception.


With Xcode 4.2 and iOS 5 uncaught exceptions do not seem to show in the console anymore. I would recommend adding the following or modifying your existing uncaught exception handler to dump the exceptions callstack for you.

#ifdef DEBUG
void eHandler(NSException *);

void eHandler(NSException *exception) {
    NSLog(@"%@", exception);
    NSLog(@"%@", [exception callStackSymbols]);
}
#endif

int main(int argc, char *argv[]) {

#ifdef DEBUG
    NSSetUncaughtExceptionHandler(&eHandler);
#endif

...rest of your main function here...

}