This page describes the steps required to re-sign an iOS app using a different bundle ID and developer account. 

Assumptions

  • XCode 10+ installed on Mac
  • Original .ipa file downloaded (named in this guide as <original>.ipa). This must be an .ipa file that was originally exported and signed for AppStore deployment.
  • App ID set up in the Apple developer account for the new app (named in this guide as new.app.id)
  • Distribution certificates created in the Apple developer account and private keys installed on local key chain (certificate named in this guide as distribution certificate name)
  • Distribution (AppStore) provisioning profiles set up in the Apple developer account for the new App ID and downloaded to the local machine (named in this guide as Jado.mobileprovision)
  • Team ID is known (visible in the Apple developer account portal membership tab (named in this guide as newteamid)

How to re-sign the ION iOS app

  1. Rename <original>.ipa to <original>.zip
  2. Double-click the zip to extract the zip contents. A folder (named Root in this example) with Payload and SwiftSupport subfolders will be extracted.
  3. Navigate to the folder containing Root in Terminal.
  4. Remove the existing code signature by executing command:

    rm -r Root/Payload/Jado.app/_CodeSignature
  5. Right-click on Root/Payload/Jado.app and select Show Package Contents.
  6. Open Root/Payload/Jado.app/Info.plist.
  7. Change the CFBundleIdentifier (BundleIdentifier) value to new.app.id
  8. Copy new provisioning profiles (Jado.mobileprovision) by executing command:

    cp Jado.mobileprovision Root/Payload/Jado.app/embedded.mobileprovision
  9. Create a file named entitlements.xml with contents:

    <?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>application-identifier</key>
          <string>newteamid.new.app.id</string>
          <key>aps-environment</key>
          <string>production</string>
          <key>com.apple.developer.team-identifier</key>
          <string>newteamid</string>
          <key>beta-reports-active</key>
          <true/>
          <key>com.apple.external-accessory.wireless-configuration</key>
          <true/>
          <key>get-task-allow</key>
          <false/>
       </dict>
    </plist>

    Ensure that the value of application-identifier is set to your team and App ID, for example:  

    <key>application-identifier</key>
    <string>QHDQWE45DU.com.nagra.jado</string>

    and the value of com.apple.developer.team-identifier is set to your team ID, for example:

    <key>com.apple.developer.team-identifier</key>
    <string>QHDQWE45DU</string>
  10. Sign each file within the Payload/Jado.app/Frameworks folder with the following command:

    find Root/Payload \( -name "*.framework" -o -name "*.dylib" \) -exec  codesign -f --deep -s "distribution certificate name""{}" \;
  11. Sign the app with command:

    codesign --entitlements entitlements.xml -f --deep -s "distribution certificate name" Root/Payload/Jado.app/
  12. Change the directory to Root.

  13. Zip the Payload folder and create the new .ipa file by executing command:

    zip -qr resigned.ipa Payload/ SwiftSupport/
  14. Upload <resigned>.ipa using Application Loader.