Search code examples
iosdistributionenterprise

Resigning an iOS provisioning profile


My client has an iOS app with In-app purchase, Game-kit and Push notifications enabled, it is currently on the app store. I would like to resign the application using an in-house enterprise distribution certificate, to test internally, but still be able to test services tied to the original provisioning profile. Is this possible?


Solution

  • I ended up doing this, which is a combination of :-

    and

    1) Create Entitlements plist, prevent issues with the Keychain etc

    <?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>GBA9L2EABG.com.your.bundle.id.MyApp</string>
        <key>get-task-allow</key>
        <false/>
    </dict>
    

    2) Unzip the IPA

    unzip Application.ipa
    

    3) Remove the old code signature

    rm -r "Payload/Application.app/_CodeSignature" "Payload/Application.app/CodeResources" 2> /dev/null | true
    

    4) Replace embedded mobile provisioning profile

    cp "MyEnterprise.mobileprovision" "Payload/Application.app/embedded.mobileprovision"
    

    5) Resign

    /usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" --resource-rules "Payload/Application.app/ResourceRules.plist" --entitlements Entitlements.plist "Payload/Application.app"
    

    6) Re-package

    zip -qr "Application.resigned.ipa" Payload