how to debug EXC_CRASH (SIGTRAP)

前端 未结 3 774
日久生厌
日久生厌 2021-02-06 08:06

i\'m running my app are running fine until i resume from background or with out location services, the app will crash.

the crash log shows Exception Type: EXC_CRASH (SI

3条回答
  •  走了就别回头了
    2021-02-06 08:17

    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...
    
    }
    

提交回复
热议问题