Skip to content

Instantly share code, notes, and snippets.

@noamtm
Created February 1, 2015 15:18
Show Gist options
  • Save noamtm/5c3aaa0b615477162ccd to your computer and use it in GitHub Desktop.
Save noamtm/5c3aaa0b615477162ccd to your computer and use it in GitHub Desktop.
iOS: Re-sign an app for distribution
# This is not a ready-to-run script. It just shows the relevant command-line calls.
XC_WORKSPACE=path/to/MyApp.xcworkspace
XC_SCHEME=MyApp
XC_CONFIG=Release
ARCHIVE_PATH=dest/path/to/MyApp.xcarchive
EXPORT_PATH=dest/path/to/MyApp.ipa
DIST_PROFILE=NameOfDistributionProfile
# Build and archive. This can be done by regular developers, using their developer key/profile.
xcodebuild -workspace $XC_WORKSPACE -scheme $XC_SCHEME -sdk iphoneos -configuration $XC_CONFIG archive -archivePath $ARCHIVE_PATH
# Export to IPA: Takes the above archive an re-signs the app using the provided profile (xcode tries to find a matching key).
xcodebuild -exportArchive -exportFormat IPA -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH -exportProvisioningProfile "$DIST_PROFILE"
@GoodMirek
Copy link

Unfortunately, use of -exportProvisioningProfile is deprecated in Xcode 7, without functionally equivalent replacement and in favor of -exportOprionsPlist. However, -exportOprionsPlist does not allow to choose a different provisioning profile. It is still possible to use -exportProvisioningProfile parameter, but export then works in a different way than with -exportOprionsPlist and results are quite undesirable. Application exported with -exportOprionsPlist is of 18MB size, while exported with -exportProvisioningProfile is of 90MB size.

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