概述
- (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];
}
最后
以上就是如意花卷为你收集整理的手动崩溃统计的全部内容,希望文章能够帮你解决手动崩溃统计所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复