Objective-C Tips & Trick - Prioregroup.com
[Objective-C] How to debug EXC CRASH (SIGTRAP)
       
back

//
// First method :
//
// 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.
//
// Second method:
//
#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...

}






Copyright © 1996-2018 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581.
prioregroup.com