UncaughtExceptionHandler捕获异常崩溃 s
2017-06-20 本文已影响30人
XLsn0w
voidUncaughtExceptionHandler(NSException*exception) {
NSArray*arr = [exceptioncallStackSymbols];//得到当前调用栈信息
NSString*reason = [exceptionreason];//非常重要,就是崩溃的原因
NSString*name = [exceptionname];//异常类型
NSLog(@"%@", arr);
NSLog(@"exception type : %@ \n崩溃的原因: %@ \n call stack info : %@", name, reason, arr);
}
objc直接调用
NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler);
__________________________________________________________________________________
__________________________________________________________________________________