AvoidCrash再也不怕程序崩溃啦

2016-11-30  本文已影响1124人  coderST
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // 1 开始监听
    [AvoidCrash becomeEffective];
    
    // 2 监听通知:AvoidCrashNotification, 获取AvoidCrash捕获的崩溃日志的详细信息
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
    return YES;
}

- (void)dealwithCrashMessage:(NSNotification *)note {
    //注意:所有的信息都在userInfo中
    //你可以在这里收集相应的崩溃信息进行相应的处理(比如传到自己服务器)
    NSLog(@"%@",note.userInfo);
}
void)viewDidLoad {
    [super viewDidLoad];
    
    NSString *nilStr = nil;
    NSMutableArray *array = [NSMutableArray array];
    [array addObject:nilStr];
}
上一篇下一篇

猜你喜欢

热点阅读