腾讯Bugly,为移动开发者提供专业的异常上报和运营统计,帮助开发者快速发现并解决异常,同时掌握产品运营动态,及时跟进用户反馈。
官方下载、文档介绍
使用
BuglyConfig *config = [[BuglyConfig alloc] init];
// 非正常退出事件记录开关
config.unexpectedTerminatingDetectionEnable = YES;
config.reportLogLevel = BuglyLogLevelWarn;
//开启卡顿监控,默认3s
config.blockMonitorEnable = YES;
config.delegate = self;
//config.blockMonitorTimeout = 1.5;
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *bundleShortVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
NSString *bundleVersion = [infoDictionary objectForKey:@"CFBundleVersion"];
config.version = [NSString stringWithFormat:@"%@(%@)",bundleShortVersion,bundleVersion];
[Bugly startWithAppId:kBuglyApiKey
#ifndef DEBUG
developmentDevice:YES
#endif
config:config];
用户标识
//设置用户标识
[Bugly setUserIdentifier:***];
用户ID.png
设置关键数据
//设置关键数据,随崩溃信息上报
[Bugly setUserValue:*** forKey:@"driverMobile"];
关键数据.png
异常代理实现
返回需上报记录,随异常上报一起上报。
- (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception {
return @"***";
}
自定义信息.png
开启卡顿监控
//开启卡顿监控,默认3s
config.blockMonitorEnable = YES;
config.delegate = self;
//config.blockMonitorTimeout = 1.5;
日志上报
......
config.reportLogLevel = BuglyLogLevelWarn;
......
[BuglyLog log:@"test1"];
NSArray *array = @[];
[array objectAtIndex:2];
[BuglyLog log:@"test2"];
BuglyLogLevelWarn.png
BuglyLogLevelInfo.png
reportLogLevel是一个枚举类型属性,BuglyLogLevelWarn及BuglyLogLevelInfo都可进行日志上报,区别在于BuglyLogLevelWarn日志相对清晰,BuglyLogLevelInfo可以将自定义的打印日志上报。










网友评论