Is it possible to embed DSYM (folder) in my IPA through Devops build?
Introduction
App Store Connect reports crashes in my production app that aren't reported through AppCenter. I see the crashes through XCode => Organizer, but the crashes aren't symbolicated.
I suspect the crashes are related to resource constraints, but I would prefer to see the stack trace before I do a lot of work on a hunch :)
Is it possible to include DSYM in the IPA that is produced through Azure Devops?
Steps to Reproduce
- Create an IPA for a Xamarin.iOS app:
- task: XamariniOS@2
inputs:
solutionFile: '**/*iOS.sln'
configuration: '$(BuildConfiguration)'
buildForSimulator: false
_packageApp: true_
runNugetRestore: true
- task: CopyFiles@2
inputs:
Contents: '**/*.dSYM/**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(BuildConfiguration)'
flattenFolders: false
- task: CopyFiles@2
inputs:
Contents: '**/*.ipa'
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(BuildConfiguration)'
flattenFolders: false
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(BuildConfiguration)'
ArtifactName: $(BuildConfiguration)
publishLocation: 'Container'
- task: AppStoreRelease@1
inputs:
serviceEndpoint: 'app store'
appIdentifier: 'xxx'
appType: 'iOS'
releaseTrack: 'TestFlight'
shouldSkipWaitingForProcessing: true
appSpecificId: 'XXX'
- I'm able to then download the DSYM through Build Artifacts: Run => Job =>

I suspect I will be able to symbolicate my crashes through some hoop jumping, but it would be nice if that was done for me by xcode / app store connect instead.
- App Store connect reports there are not Symbols in the .ipa (and I have confirmed there is no DSym in the ipa):

Question
Is it possible to configure this build (through Additional Build Arguments?, or some other step) to include DSYM in my ipa?
Thanks for the report!
This is rather complicated, because Xcode doesn't actually include the dSYM directory in the .ipa, Xcode writes .symbols files:
Symbols/049B1D6E-B91E-31DF-B6A6-F5FCC5F3CE9B.symbols
and this is a non-documented format that only Xcode knows how to create.
In order to include symbols in the .ipa, we'd have to reverse engineer this file format.
There's a workaround: you can symbolicate crash reports yourself if you have the correct dSYMs on your disk. A quick google found a walkthrough: https://www.skoumal.com/en/how-to-manually-symbolicate-crash-on-apple-platforms/ (I haven't tested this, so I don't know if it's correct, but there are many other guides available).
Thanks for the link - it looks like a much better set of instructions compared to the various articles I had found :)
I had also come across this: https://github.com/xamarin/xamarin-macios/issues/7495#issuecomment-560478166 - perhaps that's a way to turn dsym into .symbols without reverse engineering the file format?
I had also come across this: #7495 (comment) - perhaps that's a way to turn dsym into .symbols without reverse engineering the file format?
Hm yeah, it seems something like this could work (I haven't tested this):
$ xcrun symbols -noTextInSOD -noDaemon -arch all -symbolsPackageDir path/to/ipa/Symbols path/to/app.dSYM/Contents/Resources/DWARF/app
An .ipa file is just a zip file, so it might be possible to add the symbols to the ipa we create by doing something like this (also untested):
mkdir Symbols
for dsym in path/to/*.dSYM/Contents/Resources/DWARF/*; do
xcrun symbols -noTextInSOD -noDaemon -arch all -symbolsPackageDir ./Symbols $dsym
done
zip -9r path/to/app.ipa Symbols
References:
- https://github.com/bazelbuild/rules_apple/issues/709
- https://github.com/xamarin/xamarin-macios/issues/7495#issuecomment-560478166
- https://github.com/jlyonsmith/app-tools/blob/master/bin/xcarchive2ipa
That's pretty awesome - thanks!
That's pretty awesome - thanks!
Did this work for you? I have the same issue here, not managing to upload the dsym to apple. Thx
I am now taking a slightly different approach by letting dotnet build an xcarchive first and then turn it into a IPA containing symbols:
- So dotnet publish using -p:ArchiveOnBuild=true
- The archive goes to ~/Library/Developer/Xcode/Archives
- we take the last archive
- create IPA from archive
- specify to include symbols in ExportOptions.plist
- after that validate and upload to Apple.
Hereby the most important script parts
dotnet publish -f net9.0-ios -p:ArchiveOnBuild=true -o:/tmp -c AppStore >> "$publishlog"
latest_archive=$(find ~/Library/Developer/Xcode/Archives -type d -name "*.xcarchive" -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -n 1 | cut -d' ' -f2-)
echo "Taking latest archive $latest_archive"
mv "$latest_archive" "$publish_folder/xcarchive"
# Make IPA with symbols
ipa="$publish_folder/ipa"
xcodebuild -exportArchive -archivePath "$publish_folder/xcarchive" -exportPath "$ipa" -exportOptionsPlist ./ExportOptions.plist
echo validate app
xcrun altool --validate-app --type ios --file "$ipa/OneTask.ipa" --username "[email protected]" --password "$applicationpwd" >> "$publishlog"
echo upload app
xcrun altool --upload-app --type ios --file "$ipa/OneTask.ipa" --username "[email protected]" --password "$applicationpwd" >> "$publishlog"
For reference hereby the contents of ExportOptions.plist (I had to specify distribution profiles manually):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store-connect</string>
<key>signingStyle</key>
<string>automatic</string>
<key>compileBitcode</key>
<false/>
<key>stripSwiftSymbols</key>
<true/>
<key>uploadSymbols</key>
<true/>
<key>uploadBitcode</key>
<false/>
<key>destination</key>
<string>export</string>
<key>manageAppVersionAndBuildNumber</key>
<false/>
<key>signingStyle</key>
<string>manual</string>
<key>provisioningProfiles</key>
<dict>
<key><app.id></key>
<string><profile name></string>
</dict>
</dict>
</plist>