FBLeakDetector 是一个简单且有效的泄漏检测器,用于查找看起来已释放但内存中仍存在的持久视图控制器。
要求
FBLeakDetector 与 iOS 8.0+ 兼容,并需要 ARC 来构建。
安装
FBLeakDetectorVC 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile
pod 'FBLeakDetectorVC'
使用
首先,简单地从您想要监视潜在泄漏的 UIViewController(s) 继承。常见的做法是让您的 BaseViewController 继承我们的 FBLeakDetectorViewController。通过这样做,您将为所有继承自 BaseViewController 的视图控制器启用泄漏检测器。
通过以下方式覆盖 getter 以切换动作类型
@implementation BaseViewController
#pragma mark - Leak Detection Action Type
- (FBLeakDetectorActionType)leakDetectorActionType {
return FBLeakDetectorActionTypeException;
}
@end
许可
FBLeakDetectorVC 可在 MIT 许可下获得。有关更多信息,请参阅 LICENSE 文件。