5

I have been through stackOverFlow and google search's but didn't find out a proper answer to my query. I want to send a command to launch app in iOS device(connected via USB port) using command line tool (from mac system). Please don't copy paste link's in comment or in your post as I been through a lot of site's. I'm looking forward to a proper way along with understanding if anyone could provide.

I have seen ios-deploy, libimobiledevice and all but explanation is not given on how to install and use, i.e., test it whether it's working or not. If anyone have then please provide the same with bit of explanation.

Thanks in advance.

2
  • I don't think that you can launch an installed application off your iDevice. Instead, you can deploy then launch an application from your Mac into the connected iDevice via the command xcrun. Commented Jul 1, 2014 at 13:47
  • Edited: sorry, xcrun is just for creating .ipa file Commented Jul 1, 2014 at 13:53

1 Answer 1

3

Try instruments from command line, replace DEVICE_UDID, XCODE_PATH, APP_PATH, APP_NAME, TRACE_DIR and STARTING_POINT with your variables:

instruments -w DEVICE_UDID \
-t /Applications/XCODE_PATH.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
APP_PATH/APP_NAME.app \
-e UIASCRIPT STARTING_POINT.js \
-e UIARESULTSPATH TRACE_DIR \
-d TRACE_DIR

What I have in STARTING_POINT.js:

var target = UIATarget.localTarget();

This example simply launches app on device and then app exit. Note that the app needs proper signing.

Sign up to request clarification or add additional context in comments.

15 Comments

This works for a Debug code signing only. The app exits cause the app has been signed with a distribution code signing.
The app won't necessarily exit if have more instructions in automation script, there is good reference on UIATarget.
I did tried out this piece of code but faced a error of template missing (error no. is -6). Also as I understand this might require scripting for running selected app. Also what if that project doesn't exist in my path but app is installed in iDevice will it run?!
@walle84, it is probably that the template path is incorrect, would you be able to find the tracetemplate in finder? For example here is the tracetemplate on my Mac: /Applications/Xcode 5.1.1 GM/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate
It is OK if the app is already installed on device, I have the app running and controlled by a "bot" on my iPhone 5. The silver lining is that you need the MyiOSApp.app file, which found in build directory.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.