Search code examples
macosmac-app-storeapplication-loaderproductbuild

Using Application Loader to upload debug symbols


I am building and packaging a mac store app from the command line. This results in a .dSYM file I have extracted from the binary within the app using dsymutil, then we codesign the .app, then package it using productbuild.

Passing this .pkg around our team it installs successfully, and is accepted by Application Loader's pre-checks and it appears in itunes connect builds list.

The problem is that on the build details in itunes connect 'Includes Symbols' is 'No'.

Using Application Loader there doesn't appear to be any option to upload the .dSYM debug symbols.

So, any ideas on how we can upload a build to iTunes Connect where 'Includes Symbols' is 'Yes'?


Looking at xcode, it seems to create a .pkg file with a folder inside called 'Symbolication' which seems to indicate that it is the responsibility of productbuild, rather than Application Loader.


Solution

  • XCode posts out logs for each build and archive it does, by inspecting these we can see that it uses the 'symbols' tool to extract symbols from the dSYM output, then packages these with productbuild using the (undocumented) --symbolication flag.

    The log files are called:

    IDEDistribution.critical.log
    IDEDistribution.standard.log
    IDEDistribution.verbose.log
    

    within a directory ending in 'xcdistributionlogs' within /var/folders/

    So you want to do something like:

    dsymutil myapp.app/Contents/MacOS/myapp -o myapp.app.dSYM
    
    # TargetSymbolFolder must exist prior to calling symbols
    mkdir TargetSymbolFolder
    # Args are lifted from the xcode logs
    symbols -noTextInSOD -noDaemon -arch all -symbolsPackageDir TargetSymbolFolder myapp.app.dSYM/Contents/Resources/Dwarf/myapp
    
    ...other build steps, codesign and such
    
    # symbolication is undocumented, again it is from xcode logs
    productbuild --symbolication TargetSymbolFolder --component myapp.app /Applications myapp.pkg
    

    If you now use pkgutil to open up the created .pkg you can see the Sybolication folder within the pkg

    pkgutil --expand myapp.pkg myapp.pkg.expanded