iOS集成Bugly异常上报功能

1.在Bugly官网注册账号,实名认证并通过审核。
2.创建你的移动端产品,拿到AppID和AppKey。
3.集成SDK:
4.符号表:
5.上传符号表:

5.1. 自动配置会让你在打包的时候生成对应的符号表:

  • 但是并不会自动上传到bugly网站中你账号底下对应的产品的符号表管理中;


    image.png
image.png

5.2. 使用官方提供的curl命令上传符号表:

  • 注意,这里我已经cd到了dYSM所在目录,如上图中目录;
  • 在目录中执行curl命令,命令为:
curl -k "https://api.bugly.qq.com/openapi/file/upload/symbol" --form "api_version=1" --form "app_id=cf65bdb747" --form "app_key=73ac837b-8399-49f5-8e70-1b59e7316973" --form "symbolType=2"  --form "bundleId=com.demo.buglytestdemoo" --form "productVersion=1.0.1" --form "fileName=D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM" --form "file=@D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM" --verbose
  • 始终上传不了,请求出401或500或{"rtcode":"40401", msg: "server exception"},查阅了资料最终也未能解决问题;
☁  dSYMs  curl -k "https://api.bugly.qq.com/openapi/file/upload/symbol" --form "api_version=1" --form "app_id=cf65bdb747" --form "app_key=73ac837b-8399-49f5-8e70-1b59e7316973" --form "symbolType=2"  --form "bundleId=com.demo.buglytestdemoo" --form "productVersion=1.0.1" --form "fileName=D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM" --form "file=@D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM" --verbose
*   Trying 183.194.234.212...
* TCP_NODELAY set
* Connected to api.bugly.qq.com (183.194.234.212) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-CHACHA20-POLY1305
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=CN; ST=guangdong; L=shenzhen; O=Tencent Technology (Shenzhen) Company Limited; CN=*.sept03.sparta.3g.qq.com
*  start date: Sep  3 12:15:35 2021 GMT
*  expire date: Oct  5 12:15:35 2022 GMT
*  issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation CA - SHA256 - G2
*  SSL certificate verify ok.
> POST /openapi/file/upload/symbol HTTP/1.1
> Host: api.bugly.qq.com
> User-Agent: curl/7.64.1
> Accept: */*
> Transfer-Encoding: chunked
> Content-Type: multipart/form-data; boundary=------------------------bb3d4aa3a86e4290
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* Signaling end of chunked upload via terminating chunk.
< HTTP/1.1 401 Unauthorized
< Server: nginx
< Date: Tue, 22 Feb 2022 08:30:42 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 158
< Connection: keep-alive
< Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Mon, 21-Feb-2022 08:30:42 GMT
<
<html>
<head><title>401 Unauthorized</title></head>
<body>
<h1>401 Unauthorized</h1>
<p /><hr />
<small>
Resin/4.0.27
Server: 'app-0'
</small>
</body></html>
* Connection #0 to host api.bugly.qq.com left intact
* Closing connection 0
☁  dSYMs

5.3. 使用手动配置中的java上传:

  • 先下载Bugly iOS符号表工具
    里面是这两个文件
  • cd到已下载工具的目录中(如上图),之后执行命令:
  • 记得改下你的appID appKey bundleID等信息;
☁  buglyqq-upload-symbol-2  java -jar buglyqq-upload-symbol.jar -appid cf65bdb747 -appkey 73ac837b-8399-49f5-8e70-1b59e7316973  -bundleid com.renogy.buglytestdemoo  -version 1.0.1  -platform IOS -inputSymbol /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo\ 2022-2-22,\ 3.19\ PM.xcarchive/dSYMs/buglytestdemoo.app.dSYM
##[info]clear cache buglyQqUploadSymbolLib
##[info]clear cache symbolToolAndroid
##[info]bugly tools android params: -appid cf65bdb747 -appkey 73ac837b-8399-49f5-8e70-1b59e7316973 -bundleid com.renogy.buglytestdemoo -version 1.0.1 -platform IOS -inputSymbol /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM

Bugly(bugly.qq.com)符号表工具上传工具包 V1.0.48

用法 -- Usage
 java -jar buglyqq-upload-symbol.jar -appid <APP ID> -appkey <APP KEY> -bundleid <App BundleID> -version <App Version> -platform <App Platform> -inputSymbol <Original Symbol File Path> -inputMapping <Original mapping File Path>

参数说明 -- Introduction for arguments
 -appid APP ID of Bugly
 -appkey APP Key of Bugly
 -bundleid Android平台对应的是package name/iOS平台是Bundle Id
 -version APP版本,需要和bugly平台上面看到的crash版本号保持对齐
 -platform 平台类型包含三个选项 Android、IOS两个选项,注意大小写要正确
 -inputSymbol 原始符号表[ios是dsym/android平台是debug so]所在文件夹目录地址
 -inputMapping mapping所在文件夹目录地址[Android平台特有,iOS忽略]

##[info]args is ArgsParser{appId='cf65bdb747'appKey='73ac837b-8399-49f5-8e70-1b59e7316973', appPackage='com.renogy.buglytestdemoo', appVersion='1.0.1', appBuildNo='null', platformId=IOS', enviroment=null', symbolPathName='/Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM', mappingPathName='null', appPathName='null'}
##[info]deleteDirFiles file path is /Users/admin/Downloads/buglyqq-upload-symbol/buglybin/symbolResult/BuglyIosStifListZip.zip
##[info]deleteDirFiles file path is /Users/admin/Downloads/buglyqq-upload-symbol/buglybin/symbolResult
##[info]deleteDirFiles file path is /Users/admin/Downloads/buglyqq-upload-symbol/buglybin
##[info]packSymbolFile file
##[info]begin to parse dsymPath : /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM
##[info]dsymFiles: 1
##[info]begin to parse dsym file: D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM
##[info]bugly tools ios params: -i /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM -o /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM.zip
[SymtabTool-I] dSymFiles size is : 1

Bugly Symtab Tool for iOS: 3.3.4
[SymtabTool-I] Begin to parse file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglytestdemoo
[SymtabTool-I] Architecture: arm64
[SymtabTool-I] Begin to parse file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglytestdemoo
[SymtabTool-I] Architecture: arm64
[SymtabTool-I] Successfully parsed the file!
/Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglytestdemoo [arm64] d7873d8c2c6035b0a400f82c898ed4f7

[SymtabTool-I] Extracting symtab file: buglytestdemoo
[SymtabTool-I] Begin to parse file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglytestdemoo
[SymtabTool-I] Architecture: arm64
[SymtabTool-I] Successfully parsed the file!
[SymtabTool-I] Begin to parse file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglytestdemoo
[SymtabTool-I] Architecture: arm64
[SymtabTool-I] Successfully parsed the file!
[SymtabTool-I] Begin to extract symbol table..
[SymtabTool-I] Successfully to extract symbol table!
[SymtabTool-I] Begin to create symtab file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglySymbol&buglytestdemoo&arm64&d7873d8c2c6035b0a400f82c898ed4f7.symbol
[SymtabTool-I] Successfully created symtab file!
[SymtabTool-I] Begin to parse the file:/Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglySymbol&buglytestdemoo&arm64&d7873d8c2c6035b0a400f82c898ed4f7.symbol
[SymtabTool-I] Successfully parsed the file
[SymtabTool-I] Begin to construct stif file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglySymbol&buglytestdemoo&arm64&d7873d8c2c6035b0a400f82c898ed4f7.stif
[SymtabTool-I] getSymtabEntryNum: 3419
[SymtabTool-I] getIndexEntryLength: 24
[SymtabTool-I] Successfully constructed stif file
[SymtabTool-I] Add stif to symtab zip file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglySymbol&buglytestdemoo&arm64&d7873d8c2c6035b0a400f82c898ed4f7.stif
[SymtabTool-I] Begin to zip stif file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM/Contents/Resources/DWARF/buglySymbol&buglytestdemoo&arm64&d7873d8c2c6035b0a400f82c898ed4f7
[SymtabTool-I] Successfully zipped stif file!
[SymtabTool-I] Begin to zip symtab file: /Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM.zip
[SymtabTool-I] Successfully zipped symtab file!
##[info]visit file name is : buglySymbol&buglytestdemoo&arm64&d7873d8c2c6035b0a400f82c898ed4f7.zip
##[info]parseStifFileName prefix : buglySymbol arg1 : buglytestdemoo
##[info]parseStifFileName arg2 : arm64 uuid : d7873d8c2c6035b0a400f82c898ed4f7
##[info]parseStifFileName endfix : zip
##[info]SymbolFileDetailList count is : 1
##[info]sourceZipFile file path is :/Users/admin/Library/Developer/Xcode/Archives/2022-02-22/buglytestdemoo 2022-2-22, 3.19 PM.xcarchive/dSYMs/D7873D8C-2C60-35B0-A400-F82C898ED4F7.dSYM.zip
##[info]uploadSymbolFile file :/Users/admin/Downloads/buglyqq-upload-symbol/buglybin/symbolResult/BuglyIosStifListZip.zip
##[info]postRqdFile fileName: BuglyIosStifListZip.zip
##[info]now begin to uploadFile
##[info]buildName :null&null
##[info]buildID :null
##[info]appID :cf65bdb747
##[info]bundle :com.renogy.buglytestdemoo
##[info]appVersion :1.0.1
##[info]platformId :2
##[info]appBuildNumber :null
##[info]fileType :201
##[info]fileMD5 :591bb8425c525ee00c127399d4cca44a
##[info]fileSize :30729
##[info]symbolFileDetail is [{"name":"buglySymbol&buglytestdemoo&arm64&d7873d8c2c6035b0a400f82c898ed4f7.zip","uuid":"d7873d8c2c6035b0a400f82c898ed4f7","arch":"arm64","type":101,"moduleName":"buglytestdemoo"}]
##[info]request json is {"appID":"cf65bdb747","authSign":"73ac837b-8399-49f5-8e70-1b59e7316973","appVersion":"1.0.1","appBundleID":"com.renogy.buglytestdemoo","appPlatform":2,"appBuildNumber":null,"fileType":201,"fileSize":30729,"fileMD5":"591bb8425c525ee00c127399d4cca44a","clientType":7,"clientVersion":"1.0.48","buildPlatform":1,"buildID":null,"buildName":"null&null","fileInfoList":[{"name":"buglySymbol&buglytestdemoo&arm64&d7873d8c2c6035b0a400f82c898ed4f7.zip","uuid":"d7873d8c2c6035b0a400f82c898ed4f7","arch":"arm64","type":101,"moduleName":"buglytestdemoo"}],"buildRepo":null,"buildBranch":null,"buildCommitID":null}
##[info]request upload Info Url is https://symbol-v2.bugly.qq.com/trpc.eff_tool.symbol_upload_gateway.SymbolUploadGateway/uploadInfo
##[info]request gitRepoUrl is null
##[info]request gitRepoBranch is null
##[info]request gitRepoHeadCommitId is null
##[info]envtype is null
##[info]getAppModuleList is null
##[info]retCode: 200 response message: {"statusCode":0,"msg":"success","uploadReqID":"cf65bdb747-918f61b0-016b-4704-b5db-29f9c2f3df9c"}
##[info]now begin to uploadFileContent
##[info]request uploadFileurl is https://symbol-v2.bugly.qq.com/trpc.eff_tool.symbol_upload_gateway.SymbolUploadGateway/uploadFile
##[info]retCode: 200 response message: {"statusCode":0,"msg":"success","uploadReqID":"cf65bdb747-918f61b0-016b-4704-b5db-29f9c2f3df9c"}
☁  buglyqq-upload-symbol

5.3. 上传成功之后,你就会在你产品的符号表管理中看见对应uuid的符号表文件了;
5.4. 进行奔溃分析:

  • 以下是我在安装埋有奔溃代码的程序中上传的奔溃信息;
  • 可以看见原始状态只是一些堆栈信息;


    image.png
  • 查看符号表,已上传:


    image.png
  • 对出错堆栈进行解析,和我所设置的奔溃代码对应:


    image.png

    image.png
6. 至此,基本配置完成
  • 有待解决的问题:
  • 能够定位到代码行,但是看不见具体的代码段;
  • 官方的自动上传功能不生效,文档的curl命令行不通,为什么还用curl命令举例,直接换成java命令多好,让我少走点弯路;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,839评论 6 482
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,543评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 153,116评论 0 344
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,371评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,384评论 5 374
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,111评论 1 285
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,416评论 3 400
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,053评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,558评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,007评论 2 325
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,117评论 1 334
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,756评论 4 324
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,324评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,315评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,539评论 1 262
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,578评论 2 355
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,877评论 2 345

推荐阅读更多精彩内容

  • 腾讯Bugly,为移动开发者提供专业的异常上报和运营统计,帮助开发者快速发现并解决异常,同时掌握产品运营动态,及时...
    逝水流无痕阅读 12,341评论 5 16
  • 什么是符号表? 符号表是内存地址与函数名、文件名、行号的映射表。符号表元素如下所示: <起始地址> <结束地址> ...
    深圳阳光阅读 12,181评论 28 5
  • Bugly介绍 腾讯Bugly,为移动开发者提供专业的异常上报和运营统计,帮助开发者快速发现并解决异常,同时掌握产...
    Zhen斌iOS阅读 1,911评论 0 2
  • 介绍 什么是符号表? 符号表是内存地址与函数名、文件名、行号的映射表。符号表元素如下所示:<起始地址> <结束地址...
    一滴矿泉水阅读 5,266评论 1 6
  • 【原创博文,转载请注明出处!】 Bugly iOS 符号表配置官方文档入口:https://bugly.qq.co...
    RephontilZhou阅读 7,799评论 14 32