Adding missing dSYMs to Crashlytics with Fastlane

Recently some Bitrise users have faced an interesting issue with missing dSYMs… which was not an issue in fact but hindered automation for some Crashlytics users.

Everything started with a user reporting that in the build log everything seems to be fine but the dSYM file was not uploaded to Crashlytics. At first we thought that something went wrong with the step so we asked for the build log, but we didn’t find anything related to it, so we also checked the version number and UUID on Crashlytics and tried to upload the generated dSYMs manually, but we didn’t succeed.

Finally in the documentation of Fabric we found some useful articles about missing dSYMs. One says that “There can be certain situations however, when dSYM uploads fail because of unique project configurations or if you’re using Bitcode in your app”, so we checked again the build log and we found these two lines:

  • UploadBitcode: yes
  • CompileBitcode: yes

The issue is found, but how do we fix it?

What is Bitcode? What does it do?

Bitcode appeared first when Apple released Xcode 7 and it is an intermediate representation of a compiled program (part of app thinning) and it will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to store. (For more information check this page.)

Let’s get back to the Fabric article, which also says that “For Bitcode enabled builds that have been released to the iTunes store or submitted to TestFlight, Apple generates new dSYMs so we have to download the regenerated dSYMs from Xcode and then upload them to Crashlytics”.

Yeah, this will work, but we wanted all of these things works automatically, so what’s next?

Solve it with Fastlane!

Fastlane offers a solution with which you can download all available dSYM files from iTunes Connect and upload them to the crash reporting service (supported services are Crashlytics, Sentry, HockeyApp).

Just define a lane in your Fastfile:

lane :refresh_dsyms do
download_dsyms # Download dSYM files from iTC
upload_symbols_to_crashlytics # Upload them to Crashlytics
clean_build_artifacts # Delete the local dSYM files
end

… and add a Fastlane step (after the upload to iTunes Connect step) to your workflow and insert the fastlane lane to run $ fastlane refresh_dsyms

Problem solved! ✅