ios 象征性的 iPhone 应用程序崩溃报告
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1460892/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Symbolicating iPhone App Crash Reports
提问by Jasarien
I'm looking to try and symbolicate my iPhone app's crash reports.
我想尝试象征我的 iPhone 应用程序的崩溃报告。
I retrieved the crash reports from iTunes Connect. I have the application binary that I submitted to the App Store and I have the dSYM file that was generated as part of the build.
我从 iTunes Connect 中检索了崩溃报告。我有提交到 App Store 的应用程序二进制文件,我有作为构建的一部分生成的 dSYM 文件。
I have all of these files together inside a single directory that is indexed by spotlight.
我将所有这些文件放在一个由聚光灯索引的目录中。
What now?
现在怎么办?
I have tried invoking:
我试过调用:
symbolicatecrash crashreport.crash myApp.app.dSYM
and it just outputs the same text that is in the crash report to start with, not symbolicated.
它只是输出与崩溃报告中相同的文本,而不是符号化的。
Am I doing something wrong?
难道我做错了什么?
回答by Naveen Shan
Steps to analyze crash report from apple:
分析苹果崩溃报告的步骤:
Copy the release .app file which was pushed to the appstore, the .dSYM file that was created at the time of release and the crash report receive from APPLE into a FOLDER.
OPEN terminal application and go to the folder created above (using
cd
command)Run
atos -arch armv7 -o APPNAME.app/APPNAME MEMORY_LOCATION_OF_CRASH
. The memory location should be the one at which the app crashed as per the report.
将推送到 appstore 的 release .app 文件、在发布时创建的 .dSYM 文件和从 APPLE 收到的崩溃报告复制到FOLDER 中。
打开终端应用程序并转到上面创建的文件夹(使用
cd
命令)运行
atos -arch armv7 -o APPNAME.app/APPNAME MEMORY_LOCATION_OF_CRASH
。根据报告,内存位置应该是应用程序崩溃的位置。
Ex: atos -arch armv7 -o 'APPNAME.app'/'APPNAME' 0x0003b508
前任: atos -arch armv7 -o 'APPNAME.app'/'APPNAME' 0x0003b508
This would show you the exact line, method name which resulted in crash.
这将向您显示导致崩溃的确切行和方法名称。
Ex: [classname functionName:]; -510
前任: [classname functionName:]; -510
Symbolicating IPA
象征 IPA
if we use IPA for symbolicating - just rename the extention .ipa with .zip , extract it then we can get a Payload Folder which contain app. In this case we don't need .dSYM file.
如果我们使用 IPA 进行符号化 - 只需将扩展名 .ipa 重命名为 .zip ,然后将其解压缩,我们就可以得到一个包含 app 的 Payload 文件夹。在这种情况下,我们不需要 .dSYM 文件。
Note
笔记
This can only work if the app binary does not have symbols stripped. By default release builds stripped the symbols. We can change it in project build settings "Strip Debug Symbols During Copy" to NO.
这仅在应用程序二进制文件没有剥离符号时才有效。默认情况下,发布版本剥离了符号。我们可以在项目构建设置“复制期间剥离调试符号”中将其更改为否。
More details see this post
更多详情请看这篇文章
回答by Andreas Kl?ber
After reading all these answers here in order to symbolicate a crash log (and finally succeeding) I think there are some points missing here that are really important in order to determine why the invocation of symbolicatecrash does not produce a symbolicated output.
在阅读了所有这些答案以符号化崩溃日志(并最终成功)之后,我认为这里缺少一些非常重要的点,以便确定为什么 Symbolatecrash 的调用不会产生符号化的输出。
There are 3 assets that have to fit together when symbolicating a crash log:
在符号化崩溃日志时,有 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 extractedPayload/
folder. - The
.dSYM
package containing the debug symbols (i.e.example.app.dSYM
)
- 崩溃日志文件本身(即
example.crash
),从 XCode 的管理器导出或从 iTunes Connect 接收。 - 本身包含属于崩溃日志的应用程序二进制文件的
.app
包(即example.app
)。如果您有一个.ipa
包(即example.ipa
),那么您可以.app
通过解压缩该.ipa
包(即unzip example.ipa
)来提取该包。之后,.app
包驻留在解压缩的Payload/
文件夹中。 .dSYM
包含调试符号的包(即example.app.dSYM
)
Before starting symbolication you should check if all those artifacts match, which means that the crash log belongs to the binary you have and that the debug symbols are the ones produced during the build of that binary.
在开始符号化之前,您应该检查所有这些工件是否匹配,这意味着崩溃日志属于您拥有的二进制文件,并且调试符号是在构建该二进制文件期间生成的那些。
Each binary is referred by a UUID that can be seen in the crash log file:
每个二进制文件都由一个 UUID 引用,该 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
...
In this extract the crash log belongs to an app binary image named example.app/example with UUID aa5e633efda8346cab92b01320043dc3
.
在此摘录中,崩溃日志属于名为 example.app/example 且带有 UUID 的应用程序二进制映像aa5e633efda8346cab92b01320043dc3
。
You can check the UUID of the binary package you have with dwarfdump:
您可以使用 dwarfdump 检查二进制包的 UUID:
dwarfdump --uuid example.app/example
UUID: AA5E633E-FDA8-346C-AB92-B01320043DC3 (armv7) example.app/example
Afterwards you should check if the debug symbols you have also belong to that binary:
之后,您应该检查您拥有的调试符号是否也属于该二进制文件:
dwarfdump --uuid example.app.dSYM
UUID: AA5E633E-FDA8-346C-AB92-B01320043DC3 (armv7) example.app.dSYM/Contents/Resources/DWARF/example
In this example all assets fit together and you should be able to symbolicate your stacktrace.
在这个例子中,所有资产组合在一起,你应该能够象征你的堆栈跟踪。
Proceeding to the symbolicatecrash
script:
继续执行symbolicatecrash
脚本:
In Xcode 8.3 you should be able to invoke the script via
在 Xcode 8.3 中,您应该能够通过以下方式调用脚本
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash -v example.crash 2> symbolicate.log
If it is not there you may run a find . -name symbolicatecrash
in your Xcode.app directory to find it.
如果它不存在,您可以find . -name symbolicatecrash
在 Xcode.app 目录中运行 a来找到它。
As you can see there are no more parameters given. So the script has to find your application binary and debug symbols by running a spotlight search. It searches the debug symbols with a specific index called com_apple_xcode_dsym_uuids
. You can do this search yourself:
如您所见,没有给出更多参数。因此,脚本必须通过运行聚光灯搜索来找到您的应用程序二进制文件和调试符号。它使用名为 的特定索引搜索调试符号com_apple_xcode_dsym_uuids
。您可以自己进行此搜索:
mdfind 'com_apple_xcode_dsym_uuids = *'
resp.
分别
mdfind "com_apple_xcode_dsym_uuids == AA5E633E-FDA8-346C-AB92-B01320043DC3"
The first spotlight invocation gives you all indexed dSYM packages and the second one gives you the .dSYM
packages with a specific UUID. If spotlight does not find your .dSYM
package then symbolicatecrash
will neither. If you do all this stuff e.g. in a subfolder of your ~/Desktop
spotlight should be able to find everything.
第一个聚光灯调用为您提供所有索引的 dSYM 包,第二个为您.dSYM
提供具有特定 UUID的包。如果聚光灯没有找到您的.dSYM
包裹,那么symbolicatecrash
也不会。如果您执行所有这些操作,例如在您的~/Desktop
聚光灯下的子文件夹中应该能够找到所有内容。
If symbolicatecrash
finds your .dSYM
package there should be a line like the following in symbolicate.log
:
如果symbolicatecrash
找到您的.dSYM
包,则应该有如下一行symbolicate.log
:
@dsym_paths = ( <SOME_PATH>/example.app.dSYM/Contents/Resources/DWARF/example )
For finding your .app
package a spotlight search like the following is invoked by symbolicatecrash
:
要查找您的.app
包裹,请调用如下所示的聚光灯搜索symbolicatecrash
:
mdfind "kMDItemContentType == com.apple.application-bundle && (kMDItemAlternateNames == 'example.app' || kMDItemDisplayName == 'example' || kMDItemDisplayName == 'example.app')"
If symbolicatecrash
finds your .app
package there should be the following extract in symbolicate.log
:
如果symbolicatecrash
找到您的.app
包裹,则应该有以下摘录symbolicate.log
:
Number of symbols in <SOME_PATH>/example.app/example: 2209 + 19675 = 21884
Found executable <SOME_PATH>/example.app/example
-- MATCH
If all those resources are found by symbolicatecrash
it should print out the symbolicated version of your crash log.
如果所有这些资源都被symbolicatecrash
它找到,它应该打印出崩溃日志的符号版本。
If not you can pass in your dSYM and .app files directly.
如果没有,您可以直接传入 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
Note:The symbolicated backtrace will be output to terminal, not symbolicate.log
.
注意:符号化的回溯将输出到终端,而不是symbolicate.log
.
回答by Alan Rogers
With the latest version of Xcode (3.2.2), you can drag and drop any crash reports into the Device Logs section of the Xcode Organiser and they will automatically by symbolicated for you. I think this works best if you built that version of the App using Build & Archive (also part of Xcode 3.2.2)
使用最新版本的 Xcode (3.2.2),您可以将任何崩溃报告拖放到 Xcode Organizer 的 Device Logs 部分,它们会自动为您符号化。我认为如果您使用 Build & Archive(也是 Xcode 3.2.2 的一部分)构建该版本的应用程序,这将最有效
回答by SachinVsSachin
I did this successfully, using the following steps.
我使用以下步骤成功地做到了这一点。
Step 1:Create a folder in desktop, I give name it to "CrashReport" and put three files ("MYApp.app", "MyApp.app.dSYM", "MYApp_2013-07-18.crash") in it.
步骤 1:在桌面创建一个文件夹,我将其命名为“CrashReport”并在其中放置三个文件(“MYApp.app”、“MyApp.app.dSYM”、“MYApp_2013-07-18.crash”)。
Step 2:Open Finder and go to Applications, where you will find the Xcode application, right click on this and Click "Show Package Contents", after this follow this simple path. "Contents->Developer->Platforms->iPhoneOS.platform->Developer->Library->PrivateFrameworks->DTDeviceKit.framework->Versions->A->Resources"
第 2 步:打开 Finder 并转到 Applications,您将在其中找到 Xcode 应用程序,右键单击它并单击“显示包内容”,然后按照此简单路径进行操作。“Contents->Developer->Platforms->iPhoneOS.platform->Developer->Library-> PrivateFrameworks-> DTDeviceKit.framework->Versions->A->Resources”
OR
或者
"Contents->Developer->Platforms->iPhoneOS.platform->Developer->Library->PrivateFrameworks->DTDeviceKitBase.framework->Versions->A->Resources"
“Contents->Developer->Platforms->iPhoneOS.platform->Developer->Library-> PrivateFrameworks-> DTDeviceKitBase.framework->Versions->A->Resources”
OR
或者
For Xcode 6 and above the path is Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources
对于 Xcode 6 及以上版本,路径为 Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources
Where you find "symbolicatecrash" file, copy this and paste it to "CrashReport" folder.
在您找到“symbolicatecrash”文件的地方,将其复制并粘贴到“CrashReport”文件夹中。
Step 3:launch the terminal, run these 3 Command
第 3 步:启动终端,运行这 3 个命令
cd /Users/mac38/Desktop/CrashReport and press Enter button
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" and press Enter
- ./symbolicatecrash -A -v MYApp_2013-07-18.crash MyApp.app.dSYM and press Enter Now its Done.. (NOTE: versions around 6.4 or later do not have the -A option -- just leave it out).
cd /Users/mac38/Desktop/CrashReport 并按 Enter 按钮
导出 DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" 并按 Enter
- ./symbolicatecrash -A -v MYApp_2013-07-18.crash MyApp.app.dSYM 然后按 Enter 现在它完成了..(注意:6.4 或更高版本没有 -A 选项 - 只需将其省略)。
回答by William Entriken
Steps to symbolicate a crash report automatically using XCode:
使用 XCode 自动符号化崩溃报告的步骤:
UPDATED FOR XCODE 9
为 Xcode 9 更新
Connect anyiOS device to your Mac (yes a physical one, yes I know this is stupid)
Click your device on the left and VIEW DEVICE LOGS on the right
Wait. It might take a minute to show up. Maybe doing
Command-A
thenDelete
will speed this up.Critical undocumented step:rename the crash report that you got from iTunesConnect from
.txt
extension to.crash
extension
将任何iOS 设备连接到您的 Mac(是物理设备,是的,我知道这很愚蠢)
等待。可能需要一分钟才能出现。也许这样做
Command-A
,然后Delete
将加速此。未记录的关键步骤:将您从 iTunesConnect 获得的崩溃报告从
.txt
扩展.crash
名重命名为扩展名
And then Xcode will symbolicate the crash report and display the results.
然后 Xcode 将符号化崩溃报告并显示结果。
Source: https://developer.apple.com/library/ios/technotes/tn2151/_index.html
来源:https: //developer.apple.com/library/ios/technotes/tn2151/_index.html
回答by Kendall Helmstetter Gelner
I also put dsym, app bundle, and crash log together in the same directory before running symbolicate crash
在运行符号崩溃之前,我还将 dsym、应用程序包和崩溃日志放在同一目录中
Then I use this function defined in my .profile to simplify running symbolicatecrash:
然后我使用在我的 .profile 中定义的这个函数来简化符号崩溃的运行:
function desym
{
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash -A -v | more
}
The arguments added there may help you.
那里添加的参数可能对您有所帮助。
You can check to make sure spotlight "sees" your dysm files by running the command:
您可以通过运行以下命令来检查以确保聚光灯“看到”您的dysm文件:
mdfind 'com_apple_xcode_dsym_uuids = *'
Look for the dsym you have in your directory.
查找目录中的 dsym。
NOTE: As of the latest Xcode, there is no longer a Developer directory. You can find this utility here:
注意:从最新的 Xcode 开始,不再有 Developer 目录。您可以在此处找到此实用程序:
/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Vers??ions/A/Resources/symbolicatecrash
/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Vers??ions/A/Resources/symbolicatecrash
回答by averydev
I use Airbrake in my apps, which does a fairly good job of remote error logging.
我在我的应用程序中使用 Airbrake,它在远程错误记录方面做得相当不错。
Here's how I symbolicate them with atos if the backtrace needs it:
如果回溯需要,这是我用 atos 符号化它们的方式:
In Xcode (4.2) go to the organizer, right click on the archive from which the .ipa file was generated.
In Terminal, cd into the xcarchivefor instance
MyCoolApp 10-27-11 1.30 PM.xcarchive
Enter the following
atos -arch armv7 -o 'MyCoolApp.app'/'MyCoolApp'
(don't forget the single quotes)I don't include my symbol in that call. What you get is a block cursor on an empty line.
Then I copy/paste my symbol code at that block cursor and press enter. You'll see something like:
-[MyCoolVC dealloc] (in MyCoolApp) (MyCoolVC.m:34)
You're back to a block cursor and you can paste in other symbols.
在 Xcode (4.2) 中,转到管理器,右键单击生成 .ipa 文件的存档。
在终端,CD到xcarchive例如
MyCoolApp 10-27-11 1.30 PM.xcarchive
输入以下内容
atos -arch armv7 -o 'MyCoolApp.app'/'MyCoolApp'
(不要忘记单引号)我没有在那个电话中包含我的符号。你得到的是一个空行上的块光标。
然后我在该块光标处复制/粘贴我的符号代码并按回车键。你会看到类似的东西:
-[MyCoolVC dealloc] (in MyCoolApp) (MyCoolVC.m:34)
您返回到块光标,您可以粘贴其他符号。
Being able to go through your backtrace one item without re-entering the first bit is a nice time saver.
能够在不重新输入第一位的情况下通过回溯一个项目是一个很好的节省时间。
Enjoy!
享受!
回答by Aditya Aggarwal
Just a simple and updated answer for xcode 6.1.1 .
只是 xcode 6.1.1 的一个简单且更新的答案。
STEPS
脚步
1.Xcode>Window>Devices.
1.Xcode>窗口>设备。
2.Select a device from a list of devices under DEVICES section.
2. 从设备部分下的设备列表中选择一个设备。
3.Select View Device Logs.
3. 选择查看设备日志。
4.Under the All Logs section you can directly drag drop the report.crash
4.在All Logs部分下可以直接拖放report.crash
5.Xcode will automatically Symbolicate the crash report for you.
5.Xcode 会自动为你符号化崩溃报告。
6.You can find the Symbolicated crash report by matching its Date/Time with the Date/Time mentioned in your crash report.
6.您可以通过将其日期/时间与崩溃报告中提到的日期/时间进行匹配来找到符号化崩溃报告。
回答by Sam B
Even though I had been developing apps for a few years now, this was my first time debugging a binary and I felt like a complete NOOB figuring out where all the files were i.e. where is *.app *.dSYM and crash logs? I had to read multiple posts in order to figure it out. Picture is worth a thousand words and I hope this post helps anyone else in future.
尽管我已经开发应用程序好几年了,但这是我第一次调试二进制文件,我觉得自己就像一个完整的菜鸟,弄清楚所有文件在哪里,即 *.app *.dSYM 和崩溃日志在哪里?我不得不阅读多个帖子才能弄清楚。图片值一千字,我希望这篇文章将来能帮助其他人。
1- First go to itunesconnect and download your crash logs. NOTE: Is most cases you may get something like "Too few reports have been submitted for a report to be shown." Basically not enough users have submitted crash log reports to Apple in which case you can't do much of anything at that point.
1-首先转到itunesconnect并下载您的崩溃日志。注意:在大多数情况下,您是否会收到类似“提交的报告太少,无法显示报告”之类的信息。基本上没有足够的用户向 Apple 提交崩溃日志报告,在这种情况下,您此时无能为力。
2- Now if you had not changed your code since you had submitted your binary it to Apple then Launch Xcode for that project and do Product --> Archive again. Otherwise just find your latest submitted binary and right click on it.
2- 现在,如果您在将二进制文件提交给 Apple 后没有更改代码,则为该项目启动 Xcode 并再次执行 Product --> Archive。否则只需找到您最新提交的二进制文件并右键单击它。
回答by Sébastien Stormacq
Using Xcode 4, the task is even simpler:
使用 Xcode 4,任务更简单:
- open Organizer,
- click on Library |?Device Login the left column
- click on "Import" button on the bottom of the screen...
- 打开管理器,
- 点击左侧栏中的Library |?Device Log
- 单击屏幕底部的“导入”按钮...
and voilà. The log file is imported and Symbolized automatically for you. Provided you Archived the build using Xcode -> Product -> Archivefirst.
瞧。日志文件会自动为您导入和符号化。如果您首先使用Xcode -> Product ->Archived 归档构建。