Skip to content

Instantly share code, notes, and snippets.

@piinecone
Created July 2, 2014 18:28
Show Gist options
  • Save piinecone/aa1cbe2c051ed0a1e10c to your computer and use it in GitHub Desktop.
Save piinecone/aa1cbe2c051ed0a1e10c to your computer and use it in GitHub Desktop.
Unpack, resign, and repack IPA's generated with Unreal Engine 4
#!/bin/bash
# USAGE
# 1. name this file something like `distbuild`, make it executable (chmod +x), and put it in your PATH
# 2. run it and pass it the name of your project, eg `distbuild MySweetGame`
TIMESTAMP=$(date +"%m%d%y") # eg, 070214
CERT_NAME="iPhone Distribution: Your Certificate's Name (And Identifier)"
# where you want your builds to go
BUILD_PATH="/absolute/path/to/builds/$1/binaries/$1-$TIMESTAMP.ipa"
# where you keep your distribution .mobileprovision
PROFILE_PATH="/absolute/path/to/builds/$1/profiles/$1.mobileprovision"
# the unreal projects dir
UNREAL_PATH="/absolute/path/to/Documents/Unreal Projects"
IOS_BINARIES_PATH="$UNREAL_PATH/$1/Binaries/IOS"
IPA_PATH="$IOS_BINARIES_PATH/$1.ipa"
echo "Unpacking $IPA_PATH into $IOS_BINARIES_PATH"
unzip "$IPA_PATH" -d "$IOS_BINARIES_PATH" > /dev/null
echo "Creating temporary $IOS_BINARIES_PATH/ResourceRules.plist"
cp "$IOS_BINARIES_PATH/Payload/UE4Game.app/CustomResourceRules.plist" "$IOS_BINARIES_PATH/Payload/UE4Game.app/ResourceRules.plist" > /dev/null
echo "Resigning application"
xcrun -sdk iphoneos PackageApplication -v "$IOS_BINARIES_PATH/Payload/UE4Game.app" -o "$BUILD_PATH" --sign "$CERT_NAME" --embed "$PROFILE_PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment