Convert xcarchive to ipa
I’m not completely sure what changed in recent versions of Xcode but when uploading to AppStore Connect from Xcode at some point I could always export the produced ipa and related files to a directory.
These files are produced:
1
2
3
4
BeerDiary.ipa
DistributionSummary.plist
ExportOptions.plist
Packaging.log
Now only an xcarchive file seems to be generated. But no worries, it seems you can convert xcarchive back to ipa with some steps.
Based on the information on this page I came up with this simple Bash script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if [ -z "$1" ] ; then
echo "Usage: $0 <input xcarchive>"
exit 1
fi
EXPORT_PATH="${1%.*}"
echo "Exporting to $EXPORT_PATH"
mkdir -p "$EXPORT_PATH"
cat > "$EXPORT_PATH/ExportOptions.plist" << EOF
<?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>method</key>
<string>app-store</string>
<key>signingStyle</key>
<string>automatic</string>
</dict>
</plist>
EOF
xcodebuild -exportArchive -archivePath "$1" -exportPath "$EXPORT_PATH" -exportOptionsPlist "$EXPORT_PATH"/ExportOptions.plist
This takes an input xcarcive parameter and creates a directory with the same name (without the extension of course). Then it runs the appropriate xcodebuild command.
For convenience, you can also download it here
This post is licensed under CC BY 4.0 by the author.