Skip to content

Instantly share code, notes, and snippets.

@mxpr
Last active November 25, 2022 04:15
Show Gist options
  • Save mxpr/8208289a63ca4e3a35a4 to your computer and use it in GitHub Desktop.
Save mxpr/8208289a63ca4e3a35a4 to your computer and use it in GitHub Desktop.
Export Options Plist flag in xcodebuild
# Switch xcrun to leverage Xcode 7
# Note: This won't be needed once Xcode 7 is released
# and becomes the primary Xcode in use.
export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer/
# Export Archive
xcrun xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath /path/to/app.xcarchive -exportPath /path/to/app.ipa
<?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>teamID</key>
<string>MYTEAMID123</string>
<key>method</key>
<string>app-store</string>
<key>uploadSymbols</key>
<true/>
</dict>
</plist>
# Archive
xcodebuild -scheme MyApp -archivePath builds/MyApp.xcarchive archive
# Switch xcrun to leverage Xcode 7
# Note: This won't be needed once Xcode 7 is released and is the
# primary Xcode in use.
export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer/
# Export Archive
xcrun xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath builds/MyApp.xcarchive -exportPath builds/MyApp.ipa
# Unzip the ipa file to verify contents
cd builds
unzip -q MyApp.ipa
ls -al
# We should see the following folders
# - Payload
# - SwiftSupport
# - Symbols
# - WatchKitSupport
cd Payload
#Verify Watch App
xcrun codesign -dv MyApp.app/PlugIns/MyApp\ WatchKit\ Extension.appex/MyApp\ WatchKit\ App.app
#Verify Watch Extension
xcrun codesign -dv MyApp.app/PlugIns/MyApp\ WatchKit\ Extension.appex
#Verify main app
xcrun codesign -dv MyApp.app
#!/bin/sh
# Install Provisioning profiles from the command line
# Credit: http://stackoverflow.com/questions/11128284/provide-xcodebuild-with-mobileprovision-file
#
# Usage:
# ./install_profile.sh /path/to/provisioning_profile
#
die() { echo "$@" 1>&2 ; exit 1; }
if [ ! $# == 1 ]; then
echo "Usage: $0 (/path/to/provisioning_profile)"
exit
fi
provisioning_profile=$1
uuid=$(/usr/libexec/PlistBuddy -c 'Print UUID' /dev/stdin <<< $(security cms -D -i $provisioning_profile)) || die "Could not extract profile from $provisioning_profile"
echo "Found UUID: $uuid"
output=~/Library/MobileDevice/Provisioning\ Profiles/$uuid.mobileprovision
echo "copying to $output.."
cp "${provisioning_profile}" "$output" || die "failed to copy $provisioning_profile to $output"
echo "done"
@mxpr
Copy link
Author

mxpr commented Jun 20, 2015

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