Quick Tipp: Installing An App On The Simulator From Command Line
Recently I'm doing a lot UIAutomation at my day job. If you haven't played with it, I highly recommend you have look.
To make the testing scriptable I needed a way to install an app on the simulator from the command line (I already have a script which runs my UIAutomation tests).
I searched the internet for a solution and the best match I found was a repository from phonegap. While this looks promising I was more searching for a simple solution using build in features of the Xcode command line tools.
Then I remembered that xcodebuilds installs the app on the simulator when one runs unit tests with it.
Here is how to prepare the app and how to run xcodebuild to install an app on the simulator:
Fist create a demo project. It doesn't matter what it does or how it looks. If you are brave you can use a project you are working on right now. Go to Product/Scheme/New Scheme, call the scheme Install and click OK. Go to Product/Scheme/Edit Scheme, select the Test phase and add your test target. Expand the test target until you see all the tests. Deselect all tests. This scheme is not meant to be testing something, it just should install the app on the simulator.
Navigate to the project in the Terminal and run this command:
xcodebuild test -scheme Install -destination 'platform=iOS Simulator,name=iPhone 4s'
xcodebuild should now install the App on the simulator. If you have more than one SDK installed you can select the OS to run with 0S=8.1 within the destination string.
Any comments? Ping me on Twitter or App.net.