Skip to content

Instantly share code, notes, and snippets.

@arnihermann
Forked from wli/resign_ipa.md
Created September 25, 2017 20:08
Show Gist options
  • Save arnihermann/9632c290a7deaa1b514416856c7312b0 to your computer and use it in GitHub Desktop.
Save arnihermann/9632c290a7deaa1b514416856c7312b0 to your computer and use it in GitHub Desktop.
Expo build with associatedDomains

Resign Expo IPA for associatedDomains

You can also generalize these instructions to modify your ipa for any other reason.

Error message

ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value '*' for key 'com.apple.developer.associated-domains' in 'Payload/Exponent.app/Exponent' is not supported."

Assumptions

  • My app id is io.getsparks.sparks
  • My distribution certificate name is iPhone Distribution: Boost Labs, Inc
  • You are trying to set expo.ios.associatedDomains to ["applinks:yourdomain.com"] in app.json

Solution

  • Make sure you updated your "App ID" is updated with Associated Domains support: use this guide
  • Regenerate mobileprovision file - easiest way is to run exp build:ios -c to clear your existing certs, and let it generate new ones
  • Wait for build to finish
  • Download latest mobileprovision file with associated domains support from https://developer.apple.com (guide assumes you name this file ~/Downloads/myapp.mobileprovision). This step is optional for future builds, since you aren't going to be regenerating the .mobileprovision file after the first time.
  • Login to your apple account inside xcode
  • Download public distribution certificate from https://developer.apple.com and install to keychain (double-click)
  • Download private distribution certificate from exp fetch:ios:certs and install to keychain (double-click)
  • Verify certs are shown under your xcode account (under Manage Certificates)
  • Download .ipa to your local machine
  • Unzip and clean old signature.
    unzip app.ipa
    rm -rf Payload/Exponent.app/_CodeSignature/
    
  • Make sure the mobileprovision file is updated (I think this may not be necessary)
    cp ~/Downloads/myapp.mobileprovision Payload/Exponent.app/embedded.mobileprovision
    
  • Edit Payload/Exponent.app/archived-expanded-entitlements.xcent with the contents of the com.apple.developer.associated-domains key from Payload/Exponent.app/Exponent.entitlements. Should look like this:
        <key>com.apple.developer.associated-domains</key>
        <array>
                <string>applinks:yourdomain.com</string>
        </array>
    
  • Resign and zip everything together
    codesign -f -s "iPhone Distribution: Boost Labs, Inc" --entitlements Payload/Exponent.app/archived-expanded-entitlements.xcent --identifier "io.getsparks.sparks" Payload/Exponent.app
    zip -qr app.resigned.ipa Payload SwiftSupport/
    
  • Upload via Application Loader and 🎉

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment