我是靠谱客的博主 如意花卷,这篇文章主要介绍手动崩溃统计,现在分享给大家,希望可以做个参考。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//捕获异常操作

    NSSetUncaughtExceptionHandler(handle);

    return YES;

}

//异常回调

void handle(NSException *exception){

    

    NSMutableDictionary *dict = [NSMutableDictionary dictionary];

    

    NSString *name = exception.name;

    NSString *reason = exception.reason;

    NSArray *methodInfo = exception.callStackSymbols;

    dict[@"崩溃名称"]= name;

    dict[@"崩溃原因"]=reason;

    dict[@"崩溃方法"]=methodInfo;

    NSString *document = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject]stringByAppendingPathComponent:@"crashNote.plist"];

    [dict writeToFile:document atomically:YES];

    [[NSRunLoop currentRunLoop]addPort:[NSPort port] forMode:NSRunLoopCommonModes];

    [[NSRunLoop currentRunLoop]run];

  

}


最后

以上就是如意花卷最近收集整理的关于手动崩溃统计的全部内容,更多相关手动崩溃统计内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(50)

评论列表共有 0 条评论

立即
投稿
返回
顶部