DistSafeProtector
防止崩溃框架,不改变原代码支持KVO自释放,等12种崩溃
CocoaPods 安装。
在 Podfile 中添加 pod 'DistSafeProtector'。 执行 pod install 或 pod update。(如搜索不到,请更新 pod 仓库 pod repo update)导入 "DistSafeProtector.h"。
使用
以下是开启防止崩溃功能的方法,debug 模式会打印崩溃日志,同时会利用断言来使程序崩溃,也会回调 block,达到测试环境及时发现及时修改,Release 模式既不打印也不会断言崩溃,会回调 block,可以自己上传 exception 到 bugly(注意线上环境 isDebug 一定要设置为 NO)[DistSafeProtector openSafeProtectorWithDebug:YES block:^(NSException *exception, DistSafeProtectorCrashType crashType) {
}];