Analyzing Crash Reports——分析崩溃报告之一

来源:互联网 发布:cf卡数据恢复公司 编辑:程序博客网 时间:2024/06/10 07:19

以下文章翻译自:
Analyzing Crash Reports

Analyzing Crash Reports

After you distribute your app for testing by using TestFlight or after you make it available on the store, routinely download and analyze crash reports.

通过使用TestFlight分发您的app进行测试后,或者可以在app store中使用该app后,可以定期下载并分析崩溃报告。

When an app crashes, the system creates a crash log that describes the conditions under which the app terminated, in most cases including a complete stack trace for each executing thread.

当app崩溃时,系统会创建一个崩溃日志,其中描述了app终止的条件,在大多数情况下包括每个执行线程的完整堆栈跟踪。

Apple provides a crash report service that collects and aggregates user crash logs.

Apple提供了一个“崩溃报告服务”,用于收集和聚合用户崩溃日志。

Crash reports are available for apps, WatchKit extensions, and other app extensions.

崩溃报告可用于apps,WatchKit extensions和其他app extensions。

Alternatively, view crash logs directly on devices or import crash reports, as described in Viewing and Importing Crashes in the Devices Window.

或者,直接在设备上查看崩溃日志或导入崩溃报告,如“设备窗口中的查看和导入崩溃”中所述。(手机连接电脑,在Xcode中,Window->Device->左上角选择手机->View Devices Logs,稍等就会加载崩溃日志出来,根据崩溃时间来查找,有的崩溃没有时间,显示Unkonw Type可以点开看,文件中也有时间,查看是否有蛛丝马迹,比如线程wakeup太频繁之类…)

For example, if you distribute your app outside of the store, you can solicit crash reports directly from users and import them into Xcode.
例如,如果您将应用程序分发到商店之外,您可以直接从用户那里申请崩溃报告并将其导入Xcode。

About the Crash Report Service

Apple provides a service that allows you to download crash reports for the most recent app versions and builds that you distribute through the store.
Apple提供的服务允许您下载最新的app versions and builds的崩溃报告。

The service collects and groups similar crash logs into crash reports. Each build of an app may have multiple crash reports and each crash report may contain multiple crash logs.
该服务将类似的“崩溃日志”收集并分组到“崩溃报告”中。每个“应用程序的构建”可能有多个“崩溃报告”,每个“崩溃报告”可能包含多个“崩溃日志”。

However, crash logs are not sent to Apple unless the user agrees to share crash data with app developers.
但是,崩溃日志不会发送到Apple,除非用户同意与应用程序开发人员共享崩溃数据。(这里很重要了,需要收集正确设置)

TestFlight users automatically agree to share crash data. The service does the following to generate crash reports:
TestFlight用户自动同意共享崩溃数据。该服务会执行以下操作来生成崩溃报告:

  1. Collects crash logs from apps and app extensions running on user devices.
    从用户设备上运行的应用和应用扩展程序收集崩溃日志

  2. Symbolicates the crash logs (replaces memory addresses with human-readable names)

    标识(符号化)崩溃日志(用程序员可识别的名称称替换内存地址)

  3. Compares stack traces to identify and group similar crash logs into crash reports

    比较“堆栈调用顺序”,以将类似的崩溃日志识别并分组到崩溃报告中

  4. Removes all personal user data from crash logs

    从崩溃日志中删除所有个人用户数据

  5. Provides the total number of unique devices where the crash occurred

    提供崩溃发生的唯一设备总数

  6. Provides a sample set of crash logs for each crash report

    为每个崩溃报告提供一组崩溃日志

  7. Updates crash reports daily

    每天更新崩溃报告

Xcode displays information about crash reports in the Crashes
organizer:

Xcode在“organizer”组织器中显示有关崩溃报告的信息:
(打开Xcode,点击工具栏哪里的Window->Organizer,就可以看到自己所有的app,以及对应的崩溃日志Crashes)

图:图一
(CSDN不知为什么图片上传不成功,暂且去原地址看图吧)

Before Viewing Crash Reports

Perform all these steps to fully enable the crash report service. If you previously uploaded an app with symbols to iTunes Connect and distributed it using TestFlight or the store, you may already see crash reports in the Crashes organizer.

执行所有这些步骤以完全启用崩溃报告服务。如果您以前将具有符号的应用程序上传到iTunes Connect并使用TestFlight或商店进行分发,则可能已在“崩溃”组织器中看到崩溃报告。

If you do not see crash reports in the the Crashes organizer, verify that you have performed these steps.
如果在崩溃管理器中看不到崩溃报告,请验证您是否已执行这些步骤。

Step
1 . In Xcode, enter an Apple ID in Accounts preferences that belongs to the Apple Developer Program, as described in Adding Your Apple ID Account in Xcode.
在Xcode中,在属于Apple开发人员计划的帐户首选项中输入Apple ID,如Xcode中添加您的Apple ID帐户中所述。(打开Xcode->点击状态栏中苹果图标右侧的Xcode->选择Preference->Accounts,左下角有个“+”,点击添加开发者账号)

2 . Set the version and build number, as described in Setting the Version Number and Build String. If you are distributing another build of your app, increment the build string.

设置版本和版本号,如设置版本号和构建字符串中所述。如果您正在分发应用程序的其他版本,请增加构建字符串。(这个就是版本号了,类似V0.00.001之类,自增的数字)

3 . Create a single app archive and upload it to iTunes Connect with symbols, as described in Uploading Your App to iTunes Connect. (Ensure that the “Include app symbols for your application…” box is checked before you click Upload.)

创建一个单一的app archive,并将其上传到iTunes Connect的符号,如将《Uploading Your App to iTunes Connect》中所述。 (确保在单击“上传”之前选中“Include app symbols for your application…” 框。请在上传时记得这句话~~)。

Do not delete archives that you upload to iTunes Connect.

不要删除您上传到iTunes Connect的档案。

4 . In iTunes Connect, distribute the app to testers using TestFlight, as described in TestFlight Beta Testing (Optional), or submit the app for review, as described in Submitting the App to App Review.

在iTunes Connect中,按照TestFlight Beta测试(可选)中所述,使用TestFlight将应用程序分发给测试人员,或者按照《Submitting the App to App Review》所叙述,将应用程序提交审阅。

5 . Users who download your app from the store need to agree to share crash data with app developers, as described in Sharing Crash Data with App Developers. (TestFlight users automatically agree to share crash data.)

从商店下载您的应用程序的用户需要同意与应用程序开发人员共享崩溃数据,如《Sharing Crash Data with App Developers》所述。 (TestFlight用户自动同意共享崩溃数据。)
(ps:翻译到这里的时候,我已经发觉英文比中文好理解一点~_~)

6 . In Xcode, to view crash reports, enter an Apple ID that is a team agent or admin, or an iTunes Connect user, as described in Adding Your Apple ID Account in Xcode.

在Xcode中,要查看崩溃报告,请输入作为团队代理或管理员或iTunes Connect用户的Apple ID,如《Adding Your Apple ID Account in Xcode》中所述。(看第1条的方法)

7 . In Xcode, to go from a stack frame in the Crashes organizer to the source code in debug navigator, open the Xcode project that you archived and uploaded to iTunes Connect.

在Xcode中,想要从Crashes organizer中的堆栈框架转到debug navigator中的源代码,需要打开您存档并上传到iTunes Connect的Xcode项目。

Also, allow up to three days between when you first distribute your app and when crash reports appear in Xcode. To maintain a good user experience, crash data is sent from user devices to Apple when the user allows.

此外,您可以在首次分发应用程序和Xcode中出现崩溃报告时最多三天。为了保持良好的用户体验,当用户允许时,崩溃数据将从用户设备发送到Apple。

Viewing Crash Reports in the Crashes Organizer

The Crashes organizer displays crash reports for all the apps developed by all your teams.

To view crash reports

1 . In the organizer, click Crashes.
(上面几句,挺直白的,不用翻译了,主要就是说在你收集到崩溃日志后,打开Xcode-Window-Organizer-Crashes)
图片:图片二
(还是上传图片不成功,劳烦您点击这里看图片吧,图片上有1,2,3,4,5,6,7个区域,用红色圆圈标注出来了,下面分别介绍下这几个区域,第一个就是Crashes按钮,Thanks~)

2 . In the left column, select an app or local archive from the list.
The list of apps is obtained from iTunes Connect and includes information about every version and build you uploaded to iTunes Connect.

应用列表从iTunes Connect获取,并包含有关您上传到iTunes Connect的每个版本和build的信息。

3 . At the top of the second column, choose a version and build from the pop-up menu.
Xcode begins refreshing the crash reports for the version and build you select.
Xcode downloads the top 25 crash reports—crash reports with the most number of occurrences on unique devices—that occurred during the past two weeks.

Xcode开始刷新版本的崩溃报告并构建您选择。

Xcode在过去两周内下载了前25次崩溃报告 - 过去两周中“UUID”出现的次数最多的报告。

4 . In the second column, select a crash report.
The title of the crash report defaults to the stack frame where the crash likely occurred.

崩溃报告的标题默认为可能发生崩溃的堆栈帧。

The number of unique device occurrences of the crash appears below the crash title.
崩溃标题下方出现崩溃的唯一设备出现次数。

Crash reports for a WatchKit extension are denoted with a watch icon and crash reports for other app extensions are denoted with a puzzle icon.
WatchKit扩展的崩溃报告用“手表图标“表示,其他应用程序扩展的崩溃报告用“拼图图标”表示

5 . In the detail area, view the crash logs.
The detail area displays the stack trace for each thread. The stack frame where the crash occurred is highlighted in orange.

详细信息区域显示每个线程的堆栈跟踪。发生崩溃的堆叠框以橙色突出显示。

6 . In the inspector, add information and view statistics about a crash report.

在 inspector 中,添加信息并查看有关崩溃报告的统计信息。

Viewing and Finding Crash Reports

图片三
(麻烦您再次点击这里查看图片)
In the crash report list, perform these actions:

To search for crash reports, enter a string in the search field at the bottom.

To view the crash logs of a crash report in the Finder, Control-click a crash report and choose Show in Finder.

要搜索崩溃报告,请在底部的搜索字段中输入一个关键词字符串

In the detail area, perform these actions:

To view the previous or next crash log of a crash report, click the page arrows (< or >) in the footer, or click the page count (for example, 11 of 20) and choose a page from the pop-up menu.

要查看“崩溃报告”的上一个或下一个“崩溃日志”,请单击页脚中的页面箭头(<或>),或单击页面计数(例如,第11页,共20步),然后从弹出菜单中选择一个页面。

To collapse or expand the crash log, click the filter icon in the lower-left corner in the footer. Collapse the crash log to view only the stack frames in your app. Expand the crash log to view all the stack frames including framework and system stack frames.
要折叠或展开崩溃日志,请单击页脚左下角的“过滤器图标”。
折叠崩溃日志 仅 查看应用程序中的堆栈frames。展开崩溃日志以查看包括 框架 和 系统堆栈frames。

Editing Information About Crash Reports

As you resolve issues, you can store information about crash reports locally.

解决问题时,您可以在本地存储关于崩溃报告的信息。

In the crash report list, perform these actions:

To mark a crash report as resolved, select the circle next to the crash report or at the bottom of the inspector, and click “Mark as Resolved.”

要将崩溃报告标记为已解决,请选择崩溃报告旁边或检查器底部的圆圈,然后单击“标记为已解决”。(返现这个圆圈现在在Archives | Crashes 按钮正下方的崩溃报告名字前面,也就是上一张图的区域1下面)

To show or hide resolved crash reports, select the circle in the footer next to the search field.
要显示或隐藏解决的崩溃报告,请在搜索字段旁边的页脚中选择圆圈。(这一步操作的前提是上一步的圆圈勾选)

In the detail area, perform this action:

To change the name of a crash report, place the insertion point in the header and edit the text.

要更改崩溃报告的名称,请将插入点放在标题中并编辑文本(上一张图的区域1下面的圆圈后面是崩溃日志的名字,可以修改的,这一句说的就是这个意思)。

In the inspector, perform this action:

图片4
(依旧是,麻烦您移步到这里看图~~)
To add notes about a crash report, enter the notes in the Notes text field.

要添加有关崩溃报告的注释,请在右下角的“Notes”文本字段中输入备注。

Opening the Source Code in the Debug Navigator

In the detail area, perform these actions:

To go to the source code for a stack frame, hover over the stack frame and click the arrow that appears to the right.

要转到堆栈帧的源代码,将鼠标悬停在堆栈框架上,然后单击右侧出现的箭头。(图3的区域五,在某一行,悬停鼠标,右边的箭头就会出现了,点击选择对应的工程即可)

To go to the source code where the crash occurred, click the arrow that appears when you hover the pointer over the stack frame that is highlighted.

要转到发生崩溃的源代码,将指针悬停在橙色高亮的堆栈框架上时,请单击右边显示的箭头。

In the inspector, perform this action:

To go to the source code for a stack frame, click “Open in Project.”

图三,右边有个蓝色的长条,“Open in Project…”,点击可以查看源码。

Xcode opens the associated project and displays the line of code in the debug navigator.
从下图可以看出,Xcode代开对应的工程代码,并且在debug navigator中显示出触发崩溃的代码行。
图片5

Viewing Statistics About Crash Reports

View the crash data over the past two weeks by device type, operating system, and date.
根据设备类型,操作系统和日期查看过去两周的崩溃数据。

To change the device type, choose Device Type from the pop-up menu.
要更改设备类型,请从弹出菜单中选择设备类型。(右侧有个Device Type的selection,选项有:Device Type & Operation system)

To change the operating system, choose Operating System from the pop-up menu.
要更改操作系统,请从弹出菜单中选择“操作系统”。

图片6

Sharing Crash Data with App Developers

Apple can’t provide crash reports if users don’t share the crash data with app developers.
如果用户不与应用程序开发人员共享崩溃数据,Apple不能提供崩溃报告。

If a user reports a crash and you don’t have a corresponding crash report, ask the user to share the crash data with app developers.
如果用户报告崩溃并且没有相应的崩溃报告,请用户与应用程序开发人员共享崩溃数据。

Crash data is automatically sent to Apple for TestFlight apps but not apps the user downloads from the store.
崩溃数据会自动发送给Apple for TestFlight应用程序,但不会将用户从商店下载的应用程序发送到Apple。

Give these instruction to users. On all platforms, the crash data option is in the Diagnostics section of the Privacy settings.
给用户这些指示。
在所有平台上,崩溃数据选项位于手机设置页面的“隐私设置”的“分析or诊断”部分。

To share crash data with iOS developers,
1 . In Settings, tap Privacy.
在设置中,点击隐私
2 . Scroll to the bottom and tap Diagnostics & Usage.
滚动到底部,然后点击诊断和使用。
具体请看下图:
图片7

3 . If necessary, tap the Share With App Developer switch to enable it.

如有必要,请点击”与应用开发者共享”开关 以启用它。

———- 下面还有一部分,要求Mac用户与应用开发者共享崩溃数据的方法,本文就不翻了

Similarly, ask Mac users to share their crash data with app developers.

原创粉丝点击