我想尝试和象征我的iPhone应用程序的崩溃报告。

我从iTunes Connect上找到了崩溃报告。我有提交给App Store的应用程序二进制文件,我有作为构建的一部分生成的dSYM文件。

我将所有这些文件放在一个目录中,该目录以spotlight为索引。

现在该做什么?

我试着引用:

symbolicatecrash crashreport.crash myApp.app.dSYM

它只输出与崩溃报告开始时相同的文本,没有符号。

我做错什么了吗?


当前回答

使用XCode自动生成崩溃报告的步骤:

为xcode 9更新

将任何iOS设备连接到你的Mac(是的,物理设备,是的,我知道这很愚蠢) 从“窗口”菜单中选择“设备” 在左侧单击设备,在右侧单击“查看设备日志” 等待。可能要过一分钟才会出现。也许按Command-A键然后删除可以加快速度。 关键的未记录步骤:将你从iTunesConnect中获得的崩溃报告从.txt扩展名重命名为.crash扩展名 将坠机报告拖到左侧的区域

然后Xcode会将崩溃报告符号化并显示结果。

来源:https://developer.apple.com/library/ios/technotes/tn2151/_index.html

其他回答

为了符号化崩溃日志(终于成功了),在阅读了所有这些答案之后,我认为这里有一些非常重要的地方没有被发现,以便确定为什么调用symbolicatcrash不能产生符号化输出。

在表示崩溃日志时,有3种资产必须组合在一起:

The crash log file itself (i.e. example.crash), either exported from XCode's organizer or received from iTunes Connect. The .app package (i.e. example.app) that itself contains the app binary belonging to the crash log. If you have an .ipa package (i.e. example.ipa) then you can extract the .app package by unzipping the .ipa package (i.e. unzip example.ipa). Afterwards the .app package resides in the extracted Payload/ folder. The .dSYM package containing the debug symbols (i.e. example.app.dSYM)

在开始符号化之前,您应该检查是否所有这些工件都匹配,这意味着崩溃日志属于您拥有的二进制文件,而调试符号是在构建该二进制文件期间产生的。

每个二进制文件都由一个UUID引用,可以在崩溃日志文件中看到:

...
Binary Images:
0xe1000 -    0x1f0fff +example armv7  <aa5e633efda8346cab92b01320043dc3> /var/mobile/Applications/9FB5D11F-42C0-42CA-A336-4B99FF97708F/example.app/example
0x2febf000 - 0x2fedffff  dyld armv7s  <4047d926f58e36b98da92ab7a93a8aaf> /usr/lib/dyld
...

在这个摘录中,崩溃日志属于一个名为example的应用程序二进制映像。app/example使用UUID aa5e633efda8346cab92b01320043dc3。

你可以用dwarfdump检查二进制包的UUID:

dwarfdump --uuid example.app/example
UUID: AA5E633E-FDA8-346C-AB92-B01320043DC3 (armv7) example.app/example

之后,你应该检查你的调试符号是否也属于那个二进制:

dwarfdump --uuid example.app.dSYM
UUID: AA5E633E-FDA8-346C-AB92-B01320043DC3 (armv7) example.app.dSYM/Contents/Resources/DWARF/example

在这个例子中,所有资产都适合在一起,您应该能够符号化您的堆栈跟踪。

接下来是符号化的崩溃脚本:

在Xcode 8.3中,你应该能够通过

/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash -v example.crash 2> symbolicate.log

如果它不在那里,你可以运行一个查找。在你的Xcode中出现符号崩溃。应用程序目录找到它。

正如你所看到的,没有给出更多的参数。因此,脚本必须通过运行聚光灯搜索来查找应用程序二进制和调试符号。它使用名为com_apple_xcode_dsym_uuids的特定索引搜索调试符号。你可以自己搜索:

mdfind 'com_apple_xcode_dsym_uuids = *'

分别。

mdfind "com_apple_xcode_dsym_uuids == AA5E633E-FDA8-346C-AB92-B01320043DC3"

第一个spotlight调用为您提供所有已索引的dSYM包,第二个spotlight调用为您提供具有特定UUID的.dSYM包。如果spotlight没有找到你的. dsym包,那么symbolicatcrash也不会。如果你做了所有这些事情,例如在~/Desktop的子文件夹中,聚光灯应该能够找到所有东西。

如果symbolicatecrash发现了你的.dSYM包,那么在symbolic .log中应该有如下一行:

@dsym_paths = ( <SOME_PATH>/example.app.dSYM/Contents/Resources/DWARF/example )

为了找到你的.app包,像下面这样的聚光灯搜索被symbolicatecrash调用:

mdfind "kMDItemContentType == com.apple.application-bundle && (kMDItemAlternateNames == 'example.app' || kMDItemDisplayName == 'example' || kMDItemDisplayName == 'example.app')"

如果symbolicatecrash发现了你的.app包,那么在symbolic .log中应该有以下摘录:

Number of symbols in <SOME_PATH>/example.app/example: 2209 + 19675 = 21884
Found executable <SOME_PATH>/example.app/example
-- MATCH

如果所有这些资源都被symbolicatcrash找到,它应该打印出你的崩溃日志的符号化版本。

如果不是,你可以直接传入dSYM和.app文件。

symbolicatecrash -v --dsym <SOME_PATH>/<App_URI>.app.dSYM/<APP_NAME>.app.dsym <CRASHFILE> <SOME_OTHER_PATH>/<APP_NAME>.app/<APP_NAME> > symbolicate.log

注意:符号化的回溯将输出到终端,而不是symbolic .log。

在Xcode 4.2.1中,打开管理器,然后进入库/设备日志,将.crash文件拖到崩溃日志列表中。它将在几秒钟后为您显示。

注意,你必须使用与原始版本存档相同的Xcode实例(即,你的版本的存档必须存在于Organizer中)。

我更喜欢一个脚本,将象征我的所有崩溃日志。

先决条件

创建一个文件夹,放4样东西:

symbolicatecrash perl script - there are many SO answers that tells it's location The archive of the build that match the crashes (from Xcode Organizer. simple as Show in Finder and copy) [I don't sure this is necessery] All the xccrashpoint packages - (from Xcode Organizer. Show in Finder, you may copy all the packages in the directory, or the single xccrashpoint you would like to symbolicate) Add that short script to the directory: #!/bin/sh echo "cleaning old crashes from directory" rm -P *.crash rm -P *.xccrashpoint rm -r allCrashes echo "removed!" echo "" echo "--- START ---" echo "" mkdir allCrashes mkdir symboledCrashes find `ls -d *.xccrashpoint` -name "*.crash" -print -exec cp {} allCrashes/ \; cd allCrashes for crash in *.crash; do ../symbolicatecrash $crash > ../symboledCrashes/V$crash done cd .. echo "" echo "--- DONE ---" echo ""

这个脚本

运行脚本时,将得到两个目录。

allCrashes -所有来自所有xccrashpoint的所有崩溃都会在那里。 symboledCrashes -相同的崩溃,但现在有了所有的符号。 你不需要在运行脚本之前从旧的崩溃中清理目录。它会自动清洗。好运!

atos已弃用,因此如果您正在运行OSX 10.9或更高版本,您可能需要运行

xcrun atos

警告:/usr/bin/atos正在移动,将从未来的操作系统中删除 X版本。现在可以在Xcode开发工具中使用 通过:xcrun atos调用

为了表示崩溃,Spotlight必须能够找到与您提交给Apple的二进制文件同时生成的. dsym文件。由于它包含符号信息,如果它不可用,那么您就不走运了。