美文网首页
iOS 集成Bugly

iOS 集成Bugly

作者: 张天奇天张 | 来源:发表于2019-04-16 14:03 被阅读0次

    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];

    }

    相关文章

      网友评论

          本文标题:iOS 集成Bugly

          本文链接:https://www.haomeiwen.com/subject/jgkbwqtx.html