Skip to content

Instantly share code, notes, and snippets.

@seanhenry seanhenry/resign.sh
Created May 1, 2018

Embed
What would you like to do?
Changes provisioning profile, bundle ID, and resigns prebuilt iOS .ipa (Last tested Xcode 9.3)
APPNAME=YourAppName # not including .app/.ipa suffix
BUILDNUMBER=300 # change build number to this value
CERTIFICATE="iPhone Distribution: Your Organisation name here (8JSK92JDKSM)"
PROFILE="NewProvisioningProfile.mobileprovision"
BUNDLE_ID="BundleID"
cp "${APPNAME}.ipa" "${APPNAME}.zip"
mkdir contents || true
unzip "${APPNAME}.zip" -d contents
codesign -d --entitlements :Entitlements.plist "contents/Payload/${APPNAME}.app"
plutil -replace CFBundleVersion -string "${BUILDNUMBER}" "contents/Payload/${APPNAME}.app/Info.plist"
rm -r "contents/Payload/${APPNAME}.app/_CodeSignature"
rm contents/Payload/${APPNAME}.app/embedded.mobileprovision
cp "$PROFILE" contents/Payload/${APPNAME}.app/embedded.mobileprovision
xattr -cr "contents/Payload/${APPNAME}.app"
codesign -s "$CERTIFICATE" -i "$BUNDLE_ID" -f --entitlements Entitlements.plist "contents/Payload/${APPNAME}.app"
cd contents
zip -qr "../${APPNAME}_Resigned.ipa" *
cd ..
rm -r contents
rm Entitlements.plist
rm "${APPNAME}.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.