代码获取IOS crash log


void UncaughtExceptionHandler(NSException *exception) {
    NSArray *arr = [exception callStackSymbols];   //堆栈信息
    NSString *reason = [exception reason];
    NSString *name = [exception name];
   //将这三个信息写入文件 下次启动应用时上传


//在xxxappdelegate.m文件中

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after application launch.

    // Set the view controller as the window's root view controller and display.
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    
    NSSetUncaughtExceptionHandler (&UncaughtExceptionHandler);

    return YES;
}

你可能感兴趣的:(代码获取IOS crash log)