the write compile test cycle is very very tedious
The write-compile-test cycle is very very tedious when doing iPhone development on the device, because the “compile” step needs to include “install on device”, which can be very, very slow. It can take up to a minute, depending on how many apps you have installed and the current cycle of the moon. Imagine, then, doing tiny interface changes and you want to see how that tiny fix changes the UI (which sometimes you really need to do on the device to get a feel for it) – ten tries changing an animation delay could mean ten minutes of just waiting for installation. If you’re jailbroken, there is an easier faster way.
- In Cydia, install ldid, rsync and ssh
- Follow this guide to install an ssh key pair on your iPhone, so that the script can install the app without asking for password.
- Add an additional build target to your app, and call it “Upload” or something.
- Make that build target depend on your real app (as in the picture above)
- Add a “run shell script” build phase, and give it this script:
export DEVICE_NAME=Mishimazu.local rsync -avz "${CONFIGURATION_BUILD_DIR}/${PROJECT}.app" root@${DEVICE_NAME}:/Applications/ ssh root@${DEVICE_NAME} ldid -s "/Applications/${PROJECT}.app/${PROJECT}"
- Replace “Mishimazu” with the name of your iPhone.
- Change your active target to “Upload”, and build as usual.
A few notes though.
- This script does not launch the app, you’ll have to do that yourself.
- You don’t get the console routed to Xcode. Open up the Console in the Organizer for a workaround (not as good though)
- Xcode debugger won’t work
- File locations might have changed! You no longer have your private uuid bundle with your documents, but rather need to place documents and related things in /var/mobile. It’s possible NSSearchPathForDirectoriesInDomains will figure the right paths out for you, I haven’t tested; just make sure you’re aware of this
- You are no longer sandboxed. This might change assumptions you do in code
In short, only use this deployment method for simple things, and install as usual when you need to really make sure things still work as they should, before a beta or appstore deploy. Of course, if you’re targeting the Cydia store or similar, that doesn’t apply.