iOS 集成Bugly
Cocoapods 集成 pod 'Bugly'
导入头文件 #import <Bugly/Bugly.h>
添加协议BuglyDelegate
- (void)configureBugly {
BuglyConfig *config = [[BuglyConfig alloc] init];
//非正常退出事件记录开关,默认关闭
config.unexpectedTerminatingDetectionEnable = YES;
//报告级别
config.reportLogLevel = BuglyLogLevelWarn;
//设备标识
config.deviceIdentifier = [UIDevice currentDevice].identifierForVendor.UUIDString;
//开启卡顿监控
config.blockMonitorEnable = YES;
//卡顿监控判断间隔,单位为秒
config.blockMonitorTimeout = 5;
config.delegate=self;
#if DEBUG
//SDK Debug信息开关, 默认关闭
config.debugMode=YES;
config.channel=@"debug";
#else
config.channel =@"release";
#endif
[Bugly startWithAppId:@"注册bugly的AppId"
#if DEBUG
developmentDevice:YES
#endif
config:config];
}
//此方法返回的数据,可在bugly平台中异常上报,具体异常信息的跟踪数据附件信息中的crash_attach.log中查看
-(NSString*)attachmentForException:(NSException*)exception{
[BuglyreportException:exception];
return [NSString stringWithFormat:@"exceptionInfo:\nname:%@\nreason:%@",exception.name,exception.reason];
}