To symbolicate a crash log, you require XCArchive. Inside the xcarchive, we are interested in two things:
- dSYM file: It contains the debug information for the binary. MyApp.xcarchive/dSYMs/MyApp.app.dSYM/Contents/Resources/DWARF/MyApp
- BCSymbolMap file: It contains the human readable names for symbols. MyApp.xcarchive /BCSymbolMaps/.bcsymbolmap
The archive may have multiple dSYM and BCSymbolMap files if it has frameworks. We have to identify the correct BCSymbolMap file for the binary. For this, we need to extract the build UUID of the build using the dwarfdump tool.
dwarfdump --uuid MyApp,xcarchive/dSYMs/MyApp.app.dSYM/Contents/Resources/DWARF/MyApp
output:
UUID: B63B409F-FA67-334C-BDC0-28AE2BFD488A (arm64) MyApp.xcarchive/dSYMs/MyApp.app.dSYM/Contents/Resources/DWARF/MyApp
Resolve the obfuscated symbols in the dSYM file, using the dsymutil tool. Using the above symbol file:
dsymutil -symbol-map MyApp.xcarchive/MyApp.xcarchive/BCSymbolMaps/ B63B409F-FA67-334C-BDC0-28AE2BFD488A.bcsymbolmap MyApp.xcarchive/dSYMs/MyApp.app.dSYM
This command will symbolicate the dSYM file in-place. Now, if we open the crashlog in XCode, it will be able to resolve the symbols properly. Please note, XCode might need a minute to do this, so be patient. The symbols will appear automatically when it’s done.
If the crashlog was already opened in XCode before it was symbolicated, one might have to request re-symbolication from XCode. To do that, right-click on the crashlog in the device logs window and select Re-Smybolicate Log from the context menu.