MGWatchdog 0.1.3

MGWatchdog 0.1.3

测试测试通过
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年6月

Max Gordeev 维护。



  • Max Gordeev

使用方法

启动 watchdog 以捕获冻结 UI 超过 400 毫秒的用例

NSTimeInterval const delayInSeconds = 0.4; // 400 ms
[MGWatchdog startWithDelay:delayInSeconds handler:^{
    NSString *name = @"MGWatchdogException";
    NSString *reason = [NSString stringWithFormat:@"UI has been freezed for more than %.0f ms", delayinseconds * 1000.0];
    @throw [NSException exceptionWithName:name reason:reason userInfo:nil];
}];

捕获异常后,您可以简单地分析 Main 线程调用堆栈,并在您的代码中找到问题。

停止 watchdog

[MGWatchdog stop];

如果您有不可修复的 UI 冻结(例如,使用第三方 UI 库),您可以简单地告诉 watchdog 跳过直到当前 UI 循环结束时的观察。

[MGWatchdog skipCurrentLoop];

安装

MGWatchdog 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

platform :ios, '7.0'
pod "MGWatchdog"

作者

Max Gordeev, [email protected]

许可证

MGWatchdog 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。