在AppDelegate,定义方法
void catchExceptionHandler(NSException *exception) {
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
}
在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
调用
NSSetUncaughtExceptionHandler(&catchExceptionHandler);
方法