关于异常捕捉,底层方法里已有实现,在appdelegate里实现代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//捕获异常
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
return YES;
}
// exception 异常信息
void uncaughtExceptionHandler(NSException *exception)
{
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// Internal error reporting
}