自定义异常
- (void) willCrash {
NSDictionary *userInfo = @{
@"age":@12, @"text":@"momingqi is man."};
NSException *exception = [NSException exceptionWithName:@"自定义异常" reason:@"自定义异常原因" userInfo:userInfo];
@throw exception;
}
NSException异常捕获
NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler);
void UncaughtExceptionHandler(NSException *exception) {
// exception.callStackSymbols;
// exception.callStackReturnAddresses;
NSLog(@"发生Crash!%@", exception.name);
}
- 异常捕获代码执行完毕之后