Friday, September 2, 2011

How to lauch iphone app from command prompt

If you want to launch you iOS app, iphone app from command prompt/terminal, here are the steps.

1. Download iphonesim source code from https://github.com/jhaynie/iphonesim

2. Untar the package and use xcodebuild to build the package


$unzip jhaynie-iphonesim-d930444.zip
$
$ cd jhaynie-iphonesim-d930444
$ ls
README iPhoneSimulatorRemoteClient iphonesim_Prefix.pch
Source iphonesim.xcodeproj
$
$ which xcodebuild
/usr/bin/xcodebuild
$
$ xcodebuild -project iphonesim.xcodeproj -alltargets

3. After you build iphonesim project, it will create an iphonesim binary in Release folder

$ pwd
jhaynie-iphonesim-d930444/build/Release
$ ls
iphonesim iphonesim.dSYM
$

4. You can run the application by first building your application in xcode using the xcodebuild command from the command line. You can then run it in the simulator using follwing an an example:

$ iphonesim launch ~/tmp/yourproject/build/Debug.simulator/yourproject.app

You need to point to either Debug.simulator or Release.simulator based on which build type you built with.