This is the 24th day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021

preface

In the iOS project development process, the use of dSYM file analysis, can be given in the error information statistics, more convenient to find out the client exception information, but many like array transgression is only given *** -[__NSArrayM objectAtIndex:]: Index 50 beyond bounds [0.. 39]’ index 50 beyond bounds [0.. 39]’

An error prompt

*** -[__NSArrayM objectAtIndex:]: index 50 beyond bounds [0.. 39]

ObjectAtIndex: objectAtIndex: objectAtIndex: objectAtIndex: objectAtIndex: objectAtIndex: objectAtIndex: objectAtIndex: objectAtIndex: objectAtIndex

DSYM files

After compiling the project with Xcode, we will see a dSYM file with the same name. DSYM is a transfer file that stores the address mapping information of hexadecimal functions. The symbols we debug will be included in this file, and a new dSYM file will be generated every time we compile the project. Is located in the/Users / < computer user name > / Library/Developer/Xcode/Archives directory, for every release we it is necessary to save the corresponding Archives files.

Second, the role of dSYM files

When our application is packaged in release mode or goes online, we will not see the crash error as intuitively as in Xcode. At this time, we need to analyze the Crash Report file. There will be a log file in iOS device to save the memory address of the functions with errors in each application. By using Xcode’s Organizer, DeviceLog in iOS devices can be exported into crash files. In this way, function names and file names corresponding to programs in dSYM files can be queried by the address of the function that fails. However, we need to have dSYM files corresponding to the software version, which is why it is necessary to save the Archives files for each release.

Three, how to file one to one correspondence

Each xxx.app and xxx.app.dSYM file has its own UUID, and crash file also has its own UUID. As long as the UUID of these three files is consistent, we can use them to parse the correct error function information. Dwarfdump — UUID xxx.app/ XXX (XXX is your project name) 2. To query the UUID of the xxx.app.dSYM file, enter the following command in terminal: Dwarfdump –uuid xxx.app.dSYM 3. The first line of the crash file’s Incident Identifier is the UUID of the crash file.

Use of dSYM file analysis tools

1. Drag the XCarchive file in the package to any position in the software window (multiple files can be dragged at the same time here, pay special attention: the file name does not contain Spaces) 2. If you select an XCarchive file of any version, the CPU types supported by the xCarchive file are listed on the right. If you select the CPU type corresponding to the error, the CPU type is displayed. 3. Check whether the UUID displayed on the tool page is the same as the UUID displayed on the error page. 4. Enter the incorrect address in the tool text box and click Analyze.

The last

DSYM file analysis is very important, especially when the application is launched. Sometimes apple will send a specific error log in the feedback message. You can directly find the specific error location by using dSYM tool. The above is all the content of this chapter. Welcome to pay attention to the wechat public account of Sanzhan “Program Ape by Sanzhan”, and the Sina Weibo account of Sanzhan “Sanzhan 666”, welcome to pay attention!