During App approval, a rejection like the one below may occur:

There was a flash backoff, which is a fatal problem for the App and should be fixed immediately. The problem is that I didn’t crash when I tested it. I can’t see a message about Crash. I don’t know what the problem is. At this point, we will use the crash log, which contains the content we need. When you get the crash log, you see something like this:

Suddenly a face meng force, feeling will not love again.

  • What is a crash log
  • What is symbolization
  • How to judge whether symbolization is complete
  • How do I get crash logs
  • How to symbolize it
    • Use Symbolicatecrash
    • Use Xcode symbolization

What is a crash log

In the concept section, we take a look at the relevant official documents.

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 log is a debug file that records the running environment, thread and stack backtracking generated when App terminates abnormally.

What is symbolization

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.

Symbolization is the process of converting stack traceback addresses into source method or function names.

How to judge whether symbolization is complete

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.

Symbolization can be divided into three levels: unsymbolized, semi-symbolized and fully symbolized:

level The characteristics of Whether useful
No symbolic All hexadecimal addresses No one showed it to me. It’s almost useless
Half a symbolic Part hexadecimal address, part method name function name Part of it’s for people. It’s useful
The whole symbolic It’s all method names function names It’s all for people to see. It’s very useful

Thus, full symbolization is the final state of completion.

How do I get crash logs

  • If there is a problem during the review, Apple will send the crash log as an attachment to the reply, and you can download it directly.
  • Get from the device (sometimes already in a fully symbolic state that can be viewed directly)
    1. ⌘ to computer > Open Xcode > Window > Devices (shift + ⌘ + 2)
    2. Select View Devices Logs
    3. Select the file in the list, right-click and choose Export

How to symbolize it

This article introduces two methods. The first is a bit more complicated than the second, but it’s actually very simple to follow the steps

  • Use symbolic symbolicatecrash is apple provide symbolicatecrash symbolic tool, we need to the terminal input command execution, and some preparation work before this.
  1. First, go to Symbolicatecrash, open the terminal, and type:
find /Applications/Xcode.app -name symbolicatecrash -type f
Copy the code

The path location for symbolicatecrash will be printed (this may not be the same)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/DVTFou ndation.framework/symbolicatecrashCopy the code

Copy the Symbolicatecrash file into the folder you created. Then, look at the extension name of the crash log file and change it to.crash if it is.txt(apple audit returns.txt). Finally, locate the dSYM file that corresponds to the crash log (dSYM is a transit file that stores the address mapping information of the hexadecimal function, and the method names corresponding to the hexadecimal function addresses during the symbolization process are stored in this file). · Open the Organizer panel: Select the package that corresponds to the crash log version, right-click Show In Finder, select the XCarchive file, · dSYM files are in the dSYMs folder. Xcode does not create dSYM files when packaging by default. You need to set Debug Information Format to DWARF with sSYM File in the Build Settings, otherwise the dSYMs folder is empty.

2. Run the following command to view the UUID of the dSYM file

Dwarfdump --uuid dSYM file pathCopy the code

We get the following output:

UUID: cd78bb00-be55-3fc2-89AC-580437E54D36 (armv7) + a long path UUID: ab0EC401-77b7-3FF6-BF99-567FA14a45FC (arm64) + a long pathCopy the code

3. Check whether the UUID in the crash log is the same as the output UUID. The following lists some information about the Header in the crash log:

{
    "app_name": "XXXXXX"."timestamp": "The 2017-06-03 02:15:01. 50 + 0800"."app_version": "1.2.00"."slice_uuid": "ab0ec401-77b7-3ff6-bf99-567fa14a45fc"."adam_id": 1128617051,
    "build_version": "1.0.1"."share_with_app_devs": false."is_first_party": false."bug_type": "109"."os_version": "The iPhone OS 10.3.2 f89 (14)"."incident_id": "1DE9E3EF-D2DF-4A54-992A-1912BF8D285A"."name": "XXXXXX"} Incident Identifier: 1DE9E3EF-D2DF-4A54-992A-1912BF8D285A CrashReporter Key: 5 abb1af3a567bd61ac640b7daf57c472c59d9547 Hardware Model: XXX Version 1.0.1 (1.2.00) Code Type: ARM - 64 (Native) Role: Foreground Parent Process: launchd [1]Copy the code

Here we need to pay attention to the two fields “Code Type” and “slice_uuid”, “Code Type” is arm-64, so from the UUID information output in the previous step, The UUID corresponding to the ARM64 type is “AB0EC401-77b7-3FF6-BF99-567FA14a45FC”. Compare the “slice_uUID” in the Header information. The application package that generates crash logs is different from the current dSYM package. If yes, go to the next step. 4. Execute the symbolicatecrash command terminal CD to the folder created in step 1 and define DEVELOPER_DIR first:

export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
Copy the code

To perform symbolization:

./symbolicatecrash XXXX/XXXX/appName.crash XXXX/XXXX/appName.app.dSYM > customName.crash
Copy the code

After the command is executed, a customName.crash file will appear in the folder, which, if nothing else, is the symbolized crash log. PS: In this command, the path of the. Crash file must be before the path of the. DSYM file; otherwise, symbolic failure occurs. The path can be simplified to./, and the generated file name can also be log or TXT

./symbolicatecrash ./appName.crash ./appName.app.dSYM > customName.log
Copy the code

I didn’t put the file in the folder I created. The symbolization was successful. If you have any problems with it, try copying a.app file into the folder. Then execute the command. The.app file of the application is in the.ipa file exported after packaging. Change the extension name of the.ipa file to.zip. Unzip the file and open it in the Payload folder.

  • The specific operations are as follows: First, the extension name for handling crash logs should be changed to.crash if it is not.crash. Next, the device connects to the computer > Open Xcode > Window > Devices (shift + ⌘ + 2), select View Devices Logs and drop the crash log to the list to the left. Xcode will be symbolized automatically. Of course, this method also has to meet certain conditions, such as Mac application binaries and dSYM files.

To symbolicate a crash report, Xcode needs to be able to locate the following: ·The crashing Application’s Binaries and dSYM files. ·The binaries and dSYM files for all custom frameworks that The crashing application’s binaries and dSYM files application links against. For frameworks that were built from source with the application, their dSYM files are copied into the archive alongside the application’s dSYM file. For frameworks that were built by a third-party, you will need to ask the author for the dSYM file.

Comparative analysis of results

Once symbolized, let’s compare unsymbolized and fully symbolized crash logs, as well as the key messages printed by the Xcode console (only partial).

So much for the symbolic operation of crash logs.

The first time to write something, writing is not very good, if any questions welcome correction. ** if reproduced, please indicate the source, thank you ~ ** #