Preface:

Application in the process of use if produce collapse, phone will generate a ips files, by ips files collapse we can view the relevant information, but the ips address file contains many cannot see directly, after the symbolization is needed to view specific information, this article mainly introduces ips file symbolization, and provides the symbolic script.

Symbolic IPS files

Preparations:

  • To obtain the IPS file, choose Settings > Privacy > Analysis and Improvement > Analysis Data. The IPS file name is in the project name-time format, for example, crashtest-2021-06-18-165322. ips. Locate the IPS file to be analyzed and enter it
  • Get the dYSM file: Xcode menu Window -> Organizer -> Find the corresponding APP -> right click on Show in Finder -> right click on.xcarchive, click on Show package contents -> dSYMs directory inside the package
  • Get the Symbolicatecrash tool: Applications – > find Xcode package, right-click to display package content – > Contents/SharedFrameworks/DVTFoundation framework Versions/A/Resources/symbolicatecrash

You can copy the preceding files to a directory, for example, the ips_crash folder on the desktop. The following uses the ips_crash folder as an example.

Symbol:

  • Change the suffix of the IPS file to crash, for example, crashtest-2021-06-18-165322. ips -> crashtest-2021-06-18-165322. crash
  • The terminal CD is stored in the ips_crash folder
  • Use the Symbolicatecrash tool to symbolize the file with the following command format:/symbolicatecrash Crash file dSYM file > File name for storing symbolic results

As follows:

./symbolicatecrash /Users/user/Desktop/ips_crash/CrashTest-2021-06-18-165322.crash /Users/user/Desktop/ips_crash/CrashTest.app.dSYM > crashTest.crash
Copy the code

DEVELOPER_DIR” is not defined at./symbolicatecrash line 69. Using the command: export DEVELOPER_DIR = “. / Applications/Xcode app/Contents/Developer “, then call again symbolic order, finally be symbolic crash file

Use scripts to symbolize IPS files

Script:

#! /bin/bash

#Enter the desktop
cd ~/desktop

#The IPS file does not existIf [! -r "$1"] then echo -e "\nerror: ips file path missing \n" exit fi
#DYSM file path does not exist, prompt and exitIf [! -r "$2"] then echo -e "\nerror: dSYM file path \n" exit fi
#Check for the file symbolicatecrash under the path, if not, prompt and exitxcode_name="Xcode" if [ -n "$3" ] then xcode_name=$3 fi symbolicatecrash_path="/Applications/${xcode_name}.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Reso Urces /symbolicatecrash" if [! -e $symbolicatecrash_path] then echo -e "\nerror: File [${symbolicatecrash_path}] does not exist, check if Xcode name is: ${xcode_name}\n" exit fi
#Create a folder. If no folder exists, create oneIps_dir_name ="ips_symbolicatecrash" if [! -d $ips_dir_name] then echo -e "\n create ${ips_dir_name} folder "mkdir $ips_dir_name fi ips_dir_path=$(pwd)/$ips_dir_name
#Copy the ips file to the folder and change the suffix of the IPS file to. CrashEcho -e "\n Copy files to folder: The ${ips_dir_path}, Crash "cp -f $1 $IPs_dir_name ips_name=$1 ips_name=${ips_name##*/} ips_name=${ips_name%.*} mv -f $ips_dir_path/${ips_name}.ips $ips_dir_path/${ips_name}.crash
#Symbolic file
export DEVELOPER_DIR="/Applications/${xcode_name}.app/Contents/Developer"
$symbolicatecrash_path "${ips_dir_path}/${ips_name}.crash" $2 > "${ips_dir_path}/${ips_name}_log.crash"If [$? == 0] then echo -e "\n "${ips_dir_path}/${ips_name}_log.crash"\n" open ${ips_dir_path}/${ips_name}_log.crash else echo -e "\n \n" fiCopy the code

Run the /bin/bash script full path Ips file full path dSYM file:

/bin/bash /Users/user/Desktop/ips_crash.sh /Users/user/Desktop/ips_crash/CrashTest-2021-06-18-165322.ips /Users/user/Desktop/ips_crash/CrashTest.app.dSYM
Copy the code

A folder named ips_symbolicatecrash will be generated on the desktop after successful execution of the command. The files in the folder with the _log suffix will be symbolized as files, as shown in the following figure:

If the Xcode name in the application program is not Xcode, for example, Xcode_13, you need to add the Xcode name after the command. /bin/bash Script Full path IPS file Full path dSYM file Full path Xcode name:

/bin/bash /Users/user/Desktop/ips_crash.sh /Users/user/Desktop/ips_crash/CrashTest-2021-06-18-165322.ips /Users/user/Desktop/ips_crash/CrashTest.app.dSYM Xcode_13
Copy the code