强大的防止crash框架,不改变原代码支持KVO自释放

2019-02-14  本文已影响5人  白色天空729
https://github.com/lsmakethebest/LSSafeProtector

cocoapods 配置文件添加:

#防止值为空导致的crash
pod 'LSSafeProtector'

appdelegate.m文件配置:


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

    ////开启防止奔溃
    //    IsDebug=YES代表开发环境  捕捉到崩溃 ,会打印崩溃信息,同时利用断言闪退,会回调block
    //    IsDebug=NO,代表线上环境,拦截到崩溃不打印崩溃信息,也不会断言闪退,会回调block
    [LSSafeProtector openSafeProtectorWithIsDebug:NO block:^(NSException *exception, LSSafeProtectorCrashType crashType) {
        //[Bugly reportException:exception];
        DEBUGLOG(@"%@",exception);
    }];

...
}
上一篇 下一篇

猜你喜欢

热点阅读