Skip to content

Instantly share code, notes, and snippets.

@jin
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jin/26f4cf5187644b6480e7 to your computer and use it in GitHub Desktop.
Save jin/26f4cf5187644b6480e7 to your computer and use it in GitHub Desktop.
Automatically installing apps on your device wirelessly when they are built in Xcode with Jailbroken iPhone
# Requirements
# 1. ldid: http://iphonedevwiki.net/index.php/Ldid
# 2. Root SSH access to iPhone (preferably with pubkey auth)
# Configuration (remember to escape whitespace)
IP="x.x.x.x" # Phone's IP Address
WRAPPER=appname.app
TARGET=appname
echo "-- Killing remote app process and removing remote .app.."
ssh root@$IP "killall ${TARGET}; rm -rf /Applications/${WRAPPER}"
echo "-- Compiling staging version.."
rake build:device api=staging
echo "-- Doing ldid stuff.."
ldid -S "./build/iPhoneOS-7.0-Development/${WRAPPER}/${TARGET}"
echo "-- Copying app over.."
scp -r "./build/iPhoneOS-7.0-Development/${WRAPPER}" root@$IP:/Applications/
echo "-- Refreshing uicache.."
ssh root@$IP "su -c uicache mobile"
#!/bin/sh
# Modified code from original at http://iphonedevwiki.net/index.php/Xcode#Automatically_installing_apps_on_your_device_wirelessly_when_they_are_built_in_Xcode
# Modify this to your device's IP address.
IP="192.168.1.67"
osascript -e 'display notification "Updating app on iPhone" with title "Xcode"'
# Verify that the build is for iOS Device and not a Simulator.
if [ "$NATIVE_ARCH" == "armv7" ]; then
# Kill any running instances and remove the app folder.
ssh root@$IP "killall ${TARGETNAME}; rm -rf /Applications/${WRAPPER_NAME}"
osascript -e 'display notification "Killed process and removed app on iPhone" with title "Xcode"'
# Self sign the build.
ldid -S $BUILT_PRODUCTS_DIR/${WRAPPER_NAME}/$TARGETNAME
osascript -e 'display notification "ldid completed" with title "Title"'
# Copy it over.
scp -r $BUILT_PRODUCTS_DIR/${WRAPPER_NAME} root@$IP:/Applications/
osascript -e 'display notification "scp-ed app to iPhone" with title "Xcode"'
ssh root@$IP "su mobile -c uicache"
osascript -e 'display notification "uicache done" with title "Xcode"'
osascript -e 'display notification "Successfully built app on iPhone" with title "Xcode"'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment