Bugly最新接入

3,601 阅读2分钟

我正在参加「掘金·启航计划」

前言

公司最近需要接入 Bugly ,之前用的岳鹰,到期后就没有续费了。最近时间也算是可以抽空写一些文章,现在就简单做一下总结。接入的也是比较简单,主要是上传符号表,官方文档也写的很清楚,另外也会写一下这次接入遇到的问题。

项目接入

  1. cocoapod 导入 bugly,常规操作。
pod 'Bugly'
  1. bugly 初始化。分别对DEBUGRelease 做统计,包括版本号,配置渠道,用户标识。
+ (void)initBugly
{

    BuglyConfig *config = [[BuglyConfig alloc] init];

    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];

    config.version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];

#ifdef DEBUG
    // 配置渠道
    config.channel = @"DEBUG";

    config.debugMode = YES;

    config.reportLogLevel = BuglyLogLevelWarn;

    [Bugly startWithAppId:@"AppId" developmentDevice:YES config:config];

#else

    config.channel = @"AppStore";

    config.reportLogLevel = BuglyLogLevelError;

    [Bugly startWithAppId:@"AppId" config:config];

#endif

    // 设置标签
    //[Bugly setTag:1];
    // 设置用户标识
    [Bugly setUserIdentifier:uid];
}

符号表

1. 查看符号表的UDID

xcrun dwarfdump --uuid <dSYM文件>

2. 查看符号表位置

  1. 打开Xcode 顶部菜单栏 -> Window -> Organizer 窗口;
  2. 找到发布的归档包,右键点击对应归档包,选择Show in Finder操作;
  3. 右键选择定位到的归档文件,选择显示包内容操作;
  4. 选择dSYMs目录,目录内即为下载到的dSYM文件。

3. 上传符号表

  1. 下载符号表工具 buglyqq-upload-symbol
  2. 安装java。 可以参考这篇文章: Mac安装jdk
  3. cd 到 符号表工具目录。执行命令。
java -jar buglyqq-upload-symbol.jar -appid <APP ID>
                                    -appkey<APP KEY>
                                    -bundleid <App BundleID>
                                    -version <App Version>
                                    -platform IOS
                                    -inputSymbol <Original Symbol File Path>
  • appid:是buglyappid
  • appkey:是bugylyappkey
  • bundleid:是app包的bundle identifier
  • version:是app的版本号
  • inputSymbol:是App.app.dSYM的路径。这个就是符号表位置。

遇到问题

  1. 同样的版本号,上传过的符号表,如果继续上传会报错。

这时候需要在 bugly 开放平台 上选择你的应用 - 更多 - 产品设置 - 产品信息 - 点击保存一下。重新上传就可以了。

参考资料

bugly.qq.com/docs/user-g…