0

Is there a way to build an application for the iPhone, and have it running in the simulator, but using just the console?

I am trying to test an app, that will launch; send some data and then quit; if I run it via Xcode, it works fine; the simulator launch and everything is good.

But using xcodebuild; the app build but won't launch the simulator.

Is there any command or flag to do what Xcode IDE does, but using xcodebuild?

I have found an undocumented flag for the simulator, which is called "SimulateApplication", but sadly the usage is not documented; which makes it a bit hard to use.

Tried with ios-sim but my project won't work with it.

1 Answers1

0

One way is to use instruments. In a way, you'll run it under "UI automation", but you don't actually automate the UI at all. The steps are:

Compile the app:

xcodebuild -sdk iphonesimulator7.1

Create a dummy UI automation script that does nothing (myscript.js):

while(true) {
    UIATarget.localTarget().delay(100);
}

Then run the app via instruments:

instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate "$(pwd)/$(find . -name '*.app' | grep iphonesimulator)" -e UIASCRIPT myscript.js

(The find | grep monster there just translates to the full path of the compiled version of the app. You are of course free to type it manually as well if you so prefer.)

Markku Kero
  • 371
  • 3
  • 7