Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send command to launch app in iOS device using command line tool

Tags:

xcode

macos

ios

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.

like image 682
nikhil84 Avatar asked Oct 21 '22 06:10

nikhil84


1 Answers

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.

like image 182
vladof81 Avatar answered Oct 26 '22 22:10

vladof81