How to deploy the Cordova application via the CLI to the specified iPhone device?

I work with the latest version of Cordova (4.3) on OS X, and I have 2 iPhones attached to my Macbook Pro. Whenever I want to test my application, I run the following command in the terminal:

cordova run ios --device 

The script outputs the following output in the terminal:

 ** BUILD SUCCEEDED ** [....] Waiting up to 5 seconds for iOS device to be connected [....] Found iPhone 4S 'iPhone 4S' (0b2799xxxxx) connected through USB. [....] Found iPhone 4 (GSM) 'QA iPhone 4' (40daa94b6dc607595a570c0893ba54b185a85124) connected through USB. [....] Waiting for iOS device to be connected [....] Using iPhone 4S 'iPhone 4S' (0b27990xxxxxx) (0b2799xxxx). ------ Install phase ------ [ 0%] Found iPhone 4S 'iPhone 4S' (0b279904xxxxxxx) connected through USB, beginning install 

And then he proceeds to install the application in ONE from the iPhone and opens the lldb prompt. The second iPhone remains dead and silent.

When I exit lldb (via 'exit', 'y'), the scripts show an error:

 Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] y Error code 253 for command: ios-deploy with args: -d,-b,/Users/path_to_app/appname.app ERROR running one or more of the platforms: Error: /Users/path_to_app/platforms/ios/cordova/run: Command failed with exit code 2 You may not have the required environment or OS to run this project 

I went through all the CLI documentation in Cordoba and Google, but I don’t see how I can deploy the application on a specific physical iPhone device (and not on an emulator!). On Android, I can use "rootova run android --target = 06af27413440e95f", where the long number is the device id in adb. How to do it for iPhone?

I tried the following to no avail:

 cordova run ios --target='QA iPhone 4' cordova run ios --device='QA iPhone 4' cordova run ios --device --target='QA iPhone 4' 
+6
source share
1 answer

Hi, I am an ionic developer, however I use Cordova clearly. Let me try to help you.

Hello, Sergey!

I use a shell script that uses the ios-deploy node module, which can deploy and debug using Xcode.

First run this command to list all devices, you should see both of them (FYI, is it normal to deploy two devices at once using xcode?)

 ios-deploy -c 

To install ios-deploy see ( https://github.com/phonegap/ios-deploy )

Now, to connect and run commands to a specific device, use the following command:

 ios-deploy --id <device_id> --bundle my.app 

There are shortcuts for this amazing command line tool.

  Usage: ios-deploy [OPTION]... -d, --debug launch the app in GDB after installation -i, --id <device_id> the id of the device to connect to -c, --detect only detect if the device is connected -b, --bundle <bundle.app> the path to the app bundle to be installed -a, --args <args> command line arguments to pass to the app when launching it -t, --timeout <timeout> number of seconds to wait for a device to be connected -u, --unbuffered don't buffer stdout -n, --nostart do not start the app when debugging -I, --noninteractive start in non interactive mode (quit when app crashes or exits) -L, --justlaunch just launch the app and exit lldb -v, --verbose enable verbose output -m, --noinstall directly start debugging without app install (-d not required) -p, --port <number> port used for device, default: 12345 -r, --uninstall uninstall the app before install (do not use with -m; app cache and data are cleared) -1, --bundle_id <bundle id> specify bundle id for list and upload -l, --list list files -o, --upload <file> upload file -w, --download download app tree -2, --to <target pathname> use together with up/download file/tree. specify target -V, --version print the executable version -e, --exists check if the app with given bundle_id is installed or not 
+12
source

Source: https://habr.com/ru/post/984204/


All Articles