项目介绍:
项目地址 点击查看项目代码
代码地址 https://github.com/lsmakethebest/LSSafeProtector
目前支持以下类型crash
- LSSafeProtectorCrashTypeSelector
- LSSafeProtectorCrashTypeKVO,
- LSSafeProtectorCrashTypeNSArray,
- LSSafeProtectorCrashTypeNSMutableArray,
- LSSafeProtectorCrashTypeNSDictionary,
- LSSafeProtectorCrashTypeNSMutableDictionary,
- LSSafeProtectorCrashTypeNSStirng,
- LSSafeProtectorCrashTypeNSMutableString,
- LSSafeProtectorCrashTypeNSAttributedString,
- LSSafeProtectorCrashTypeNSMutableAttributedString,
- LSSafeProtectorCrashTypeNSNotificationCenter
#import "NSObject+Safe.h"通过如下方式开启防止闪退功能,debug模式会打印crash日志,同时会利用断言来让程序闪退,也会回调block,达到测试环境及时发现及时修改,Release模式既不打印也不会断言闪退,会回调block,自己可以上传exception到bugly
- [NSObject openAllSafeProtectorWithIsDebug:YES block:^(NSException *exception, LSSafeProtectorCrashType crashType) { [Bugly reportException:exception]; }];
复制代码
使用过程中如果有什么问题或建议,欢迎提问,如果您觉得好用,可以留下您的star,谢谢了