程序异常崩溃的时候 上报服务器日志

 (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
   NSSetUncaughtExceptionHandler (&UncaughtExceptionHandler);
    
    
    return YES;
}

void UncaughtExceptionHandler(NSException *exception) {
    
    NSArray *arr = [exception callStackSymbols];//得到当前调用栈信息
    NSString *reason = [exception reason];//非常重要,就是崩溃的原因
    NSString *name = [exception name];//异常类型
    //打印错误信息:
    NSLog(@"exception type : %@ \n crash reason : %@ \n call stack info : %@", name, reason, arr);
}


你可能感兴趣的:(程序异常崩溃的时候 上报服务器日志)