Xcode 9 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. 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. Apple
provides a crash report service that collects and aggregates user crash
logs. Crash reports are available for apps, WatchKit extensions, and
other app extensions.

Alternatively, view crash logs directly on devices or import crash
reports, as described in Viewing and
Importing Crashes in the Devices
Window.
For example, if you distribute your app outside of the store, you can
solicit crash reports directly from users and import them into
Xcode.

 

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. 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. Apple
provides a crash report service that collects and aggregates user crash
logs. Crash reports are available for apps, WatchKit extensions, and
other app extensions.

Alternatively, view crash logs directly on devices or import crash
reports, as described in Viewing and
Importing Crashes in the Devices
Window.
For example, if you distribute your app outside of the store, you can
solicit crash reports directly from users and import them into
Xcode.

 

Introduction

When an application crashes, a crash report is created and stored on the
device. Crash reports describe the conditions under which the
application terminated, in most cases including a complete backtrace for
each executing thread, and are typically very useful for debugging
issues in the application. You should look at these crash reports to
understand what crashes your application is having, and then try to fix
them.

Crash reports with backtraces need to be symbolicated before they can be
analyzed. Symbolication replaces memory addresses with human-readable
function names and line numbers. If you get crash logs off a device
through Xcode’s Devices window, then they will be symbolicated for you
automatically after a few seconds. Otherwise you will need to
symbolicate the .crash file yourself by importing it to the Xcode
Devices window. See Symbolicating Crash
Reports for
details. 

A Low Memory report differs from other crash reports in that there are
no backtraces in this type of report. When a low memory crash happens,
you must investigate your memory usage patterns and your responses to
low memory warnings. This document points to you several memory
management references that you might find useful.

Back to
Top

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. 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. Apple
provides a crash report service that collects and aggregates user crash
logs. Crash reports are available for apps, WatchKit extensions, and
other app extensions.

Alternatively, view crash logs directly on devices or import crash
reports, as described in Viewing and
Importing Crashes in the Devices Window. For example, if you distribute
your app outside of the store, you can solicit crash reports directly
from users and import them into 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. 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. TestFlight users automatically agree to share crash data.
The service does the following to generate crash reports:

  • Collects crash logs from apps and app extensions running on user
    devices

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

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

  • Removes all personal user data from crash logs

  • Provides the total number of unique devices where the crash occurred

  • Provides a sample set of crash logs for each crash report

  • Updates crash reports daily

Xcode displays information about crash reports in the Crashes organizer:

图片 1

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. 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. TestFlight users automatically agree to share crash data.
The service does the following to generate crash reports:

  • Collects crash logs from apps and app extensions running on user
    devices

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

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

  • Removes all personal user data from crash logs

  • Provides the total number of unique devices where the crash occurred

  • Provides a sample set of crash logs for each crash report

  • Updates crash reports daily

Xcode displays information about crash reports in the Crashes organizer:

图片 2

Acquiring Crash and Low Memory Reports

Debugging Deployed iOS
Apps discusses
how to retrieve crash and low memory reports directly from an iOS
device. 

Analyzing Crash
Reports in
the App Distribution
Guide discusses
how to view aggregate crash reports collected from TestFlight beta
testers and users who have downloaded your app from the App
Store.

Back to
Top

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. 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. TestFlight users automatically agree to share crash data.
The service does the following to generate crash reports:

  • Collects crash logs from apps and app extensions running on user
    devices

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

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

  • Removes all personal user data from crash logs

  • Provides the total number of unique devices where the crash occurred

  • Provides a sample set of crash logs for each crash report

  • Updates crash reports daily

Xcode displays information about crash reports in the Crashes organizer:

图片 3

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. If you do not see crash reports in the
the Crashes organizer, verify that you have performed these steps.

 

Step

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.

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.

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.)

Do not delete archives that you upload to iTunes Connect.

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.

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.)

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.

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.

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.

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. If you do not see crash reports in the
the Crashes organizer, verify that you have performed these steps.

 

Step

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.

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.

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.)

Do not delete archives that you upload to iTunes Connect.

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.

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.)

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.

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.

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.

Symbolicating Crash Reports

Symbolication is the process of resolving backtrace addresses to source code method or
function names, known as symbols. Without first symbolicating a crash
report it is difficult to determine where the crash occurred.

Note: Low Memory Reports do not need to be symbolicated.

 

Note: Crash reports from macOS are typically symbolicated, or partially
symbolicated, at the time they are generated. This section focuses on
symbolicating crash reports from iOS, watchOS, and tvOS, but the overall
process is similar for macOS.

 

Figure 1  Overview of the crash reporting
and symbolication
process.图片 4

  1. As the compiler translates your source code into machine code, it
    also generates debug symbols which map each machine instruction in
    the compiled binary back to the line of source code from which it
    originated. Depending on the Debug Information
    Format (DEBUG_INFORMATION_FORMAT) build setting, these debug
    symbols are stored inside the binary or in a companion Debug Symbol
    (dSYM) file. By default, debug builds of an application store the
    debug symbols inside the compiled binary while release builds of an
    application store the debug symbols in a companion dSYM file to
    reduce the binary size.

    The Debug Symbol file and application binary are tied together on a
    per-build-basis by the build UUID. A new UUID is generated for each
    build of your application and uniquely identifies that build. Even
    if a functionally-identical executable is rebuilt from the same
    source code, with the same compiler settings, it will have a
    different build UUID. Debug Symbol files from subsequent builds,
    even from the same source files, will not interoperate with binaries
    from other builds.

  2. When you archive the application for distribution, Xcode will gather
    the application binary along with the .dSYM file and store them at
    a location inside your home folder. You can find all of your
    archived applications in the Xcode Organizer under the “Archived”
    section. For more information about creating an archive, refer to
    the App Distribution
    Guide.

    Important: To symbolicate crash reports from testers, app review,
    and customers, you must retain the archive for each build of your
    application that you distribute.

     

  3. If you are distributing your app via the App Store, or conducting a
    beta test using Test Flight, you will be given the option of
    including the dSYM file when uploading your archive to iTunes
    Connect. In the submission dialog, check “Include app symbols for
    your application…”. Uploading your dSYM file is necessary to
    receive crash reports collected from TestFlight users and customers
    who have opted to share diagnostic data. For more information about
    the crash reporting service, refer to the App Distribution
    Guide.

    Important: Crash reports received from App Review will be unsymbolicated, even if you included
    the dSYM file when uploading your archive to iTunes Connect. You
    will need to symbolicate any crash reports received from App Review
    using Xcode. See Symbolicating iOS Crash
    Reports With
    Xcode.

     

  4. When your application crashes, an unsymbolicated crash report is created and
    stored on the device. 

  5. Users can retrieve crash reports directly from their device by
    following the steps in Debugging
    Deployed iOS
    Apps.
    If you have distributed your application via AdHoc or Enterprise
    distribution, this is the only way to acquire crash reports from
    your users.

  6. Crash reports retrieved from a device are unsymbolicated and will need to be symbolicated using Xcode. Xcode uses
    the dSYM file associated with your application binary to replace
    each address in the backtrace with its
    originating location in your source code. The result is a
    symbolicated crash report.

  7. If the user has opted to share diagnostic data with Apple, or if the
    user has installed a beta version of your application through
    TestFlight, the crash report is uploaded to the App Store.

  8. The App Store symbolicates the crash report and groups it with
    similar crash reports. This aggregate of similar crash reports is
    called a Crash Point.

  9. The symbolicated crash reports are made available to you in Xcode’s
    Crashes organizer.

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. If you do not see crash reports in the
the Crashes organizer, verify that you have performed these steps.

 

Step

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.

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.

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.)

Do not delete archives that you upload to iTunes Connect.

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.

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.)

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.

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.

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.

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.

    图片 5

  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.

  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.

  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
    (图片 6) and crash reports
    for other app extensions are denoted with a puzzle icon
    (图片 7).

  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.

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.

    图片 8

  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.

  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.

  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
    (图片 9) and crash reports
    for other app extensions are denoted with a puzzle icon
    (图片 10).

  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.

Bitcode

Bitcode is an intermediate representation of a compiled program. When
you archive an application with bitcode enabled, the compiler produces
binaries containing bitcode rather than machine code. Once the binary
has been uploaded to the App Store, the bitcode is compiled down to
machine code. The App Store may compile the bitcode again in the future,
to take advantage of future compiler improvements without any action on
your part.

Figure 2  Overview of the Bitcode
compilation process.图片 11

Because the final compilation of your binary occurs on the App Store,
your Mac will not contain the debug symbol (dSYM) files needed to
symbolicate crash reports received from App Review or from users who
have sent you crash reports from their devices. Although a dSYM file
is produced when you archive your application, it is for the bitcode
binary and can not be used to symbolicate crash reports. The App Store
makes the dSYM files generated during bitcode compilation available
for you to download, from Xcode or from the iTunes Connect website. You
must download these dSYM files in order to symbolicate crash reports
received from App Review or from users who have sent you crash reports
from their devices. Crash reports received through the crash reporting
service will be symbolicated automatically.

Important: The binary compiled by the App Store will have different
UUIDs than the binary that was originally submitted.

 

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.

    图片 12

  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.

  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.

  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
    (图片 13)
    and crash reports for other app extensions are denoted with a puzzle
    icon
    (图片 14).

  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.

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.

图片 15

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.

  • To collapse or expand the crash log, click the filter icon
    (图片 16) 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.

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.

图片 17

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.

  • To collapse or expand the crash log, click the filter icon
    (图片 18) 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.

To download the dSYMs files from Xcode

  1. In the Archives organizer, select the archive that you originally
    submitted to the App Store.

  2. Click the Download dSYMs button.

Xcode downloads the dSYM files and inserts them into the selected
archive.

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.

图片 19

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.

  • To collapse or expand the crash log, click the filter icon
    (图片 20)
    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.

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.”

  • To show or hide resolved crash reports, select the circle
    (图片 21) 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.

图片 22

In the inspector, perform this action:

  • To add notes about a crash report, enter the notes in the Notes text
    field.

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.”

  • To show or hide resolved crash reports, select the circle
    (图片 23) 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.

图片 24

In the inspector, perform this action:

  • To add notes about a crash report, enter the notes in the Notes text
    field.

To download the dSYMs files from the iTunes Connect website

  1. Open the App Details page.

  2. Click Activity.

  3. From the list of All Builds, select a version.

  4. Click the Download dSYM link.

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.”

  • To show or hide resolved crash reports, select the circle
    (图片 25)
    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.

图片 26

In the inspector, perform this action:

  • To add notes about a crash report, enter the notes in the Notes text
    field.

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.

  • 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.”

图片 27

Xcode opens the associated project and displays the line of code in the
debug navigator.

图片 28

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.

  • 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.”

图片 29

Xcode opens the associated project and displays the line of code in the
debug navigator.

图片 30

Determining Whether a Crash Report is Symbolicated

A crash report may be unsymbolicated, fully symbolicated, or partially
symbolicated. Unsymbolicated crash reports will not contain the method
or function names in the backtrace. Instead,
you have hexadecimal addresses of executable code within the loaded
binary images. In a fully symbolicated crash report, the hexadecimal
addresses in every line of the backtrace are replaced with the
corresponding symbol. In a partially symbolicated crash report, only
some of the addresses in the backtrace have been replaced with their
corresponding symbols.

Obviously, you should try to fully symbolicate any crash report you
receive as it will provide the most insight about the crash. A partially
symbolicated crash report may contain enough information to understand
the crash, depending upon the type of crash and which parts of the
backtraces were successfully symbolicated. An unsymbolicated crash
report is rarely useful.

Figure 3  The same backtrace at various
levels of
symbolication.图片 31

Author

发表评论

电子邮件地址不会被公开。 必填项已用*标注