APP的看门狗,基于runtime的Swizzle Method的crash防护框架,能实时捕获导致app崩溃的破坏因子并自动修复,保持应用的健壮性。
- Unrecognized Selector Sent to Instance/class
- 容器类的数组越界,key-value参数异常
- KVO crash
- 移除了未注册的观察者,导致崩溃
- 重复移除多次,移除次数多于添加次数,导致崩溃
- 观察者没有实现observeValueForKeyPath:导致崩溃
- 添加keypath为空字符串时,导致崩溃
- 添加或者移除时 keypath == nil,导致崩溃
- KVC crash
- key/keypath值不正确
- 设置的值的类型不匹配
- NSString,NSMutableString,NSAttributedString,NSMutableAttributedString(下标越界以及参数nil异常)
- NSTimer(忘记invalidate ,导致内存泄漏)
- 不在主线程刷新UI
- NSNull 方法不存在
- 野指针
- ✅ Unrecognized Selector crash
- ✅ Container crash
- ✅ KVO crash
- ✅ KVC crash
- ✅ NSString类族 Crash
- ✅ NSTimer
- ✅ NSNull
- 开启防止Crash组件
//1. 启动所有避免crash组件
[NFGuardDog startAvoidAllCrashWithdelegate:self];
//2. 启动部分避免crash组件
NFAvoidCrashType type = NFAvoidCrashTypeKVC | NFAvoidCrashTypeKVO;
[NFGuardDog startAvoidCrash:type delegate:self];
//3. 关闭组件
[NFGuardDog stopAvoidCrash];
//4. 实现NFAvoidCrashDelegate协议
- (void)nf_handleAvoidCrashException:(NFCrashException *)exception{
NSLog(@"🐞🐞🐞:you have a crash need to process,see upward⬆️");
//To do: 你可以在这儿上传捕获的异常😎😎😎
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
NFGuardDog is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'NFGuardDog'
- ✅ AvoidCrash
- ❎ 日志收集
- ❎ FPS监控
- ❎ crash收集
- ❎ 流量监控
JIANG PENGH CHENG, [email protected]
NFGuardDog is available under the MIT license. See the LICENSE file for more info.