Ionic-cli run task: set device of simulator


#1

Hi,
I would like to run the iOS simulator with a different device setting (iPad). afaik ionic-cli uses ios-sim under the hood. ios-sim supports a “–family” argument, e.g. “–family ipad” to use iPad as simulated device.
Is there an arg for “ionic ios run” that can be used for this?
Kind Regards,
Jan


CLI Livereload iPad
#2

Hey there, ionic wraps cordova, which as far as I know (from a few cursory google searches) doesn’t allow any way to specify the “–family” argument from the command line.

So your best bet is probably to just use the ios-sim command directly, since that is all cordova does for iOS.


#3

For everybody else searching the way to replace the default emulate behavior, in place of using ionic emulate ios, you can use

cordova emulate ios --target="iPhone"
cordova emulate ios --target="iPad"
cordova emulate ios --target="iPad (Retina)"
cordova emulate ios --target="iPhone (Retina 3.5-inch)"
cordova emulate ios --target="iPhone (Retina 4-inch)" 

Source: http://stackoverflow.com/questions/22310526/cordova-start-specific-ios-emulator-image

cheers


#4

Don’t suppose anyone has discovered the settings to enable the iOS emulator to run in iPhone 6/6 Plus mode? I’ve tried a few things i.e running ios-sim directly using the --devicetypeid iPhone-6:-

ios-sim launch “app path here” --devicetypeid iPhone-6

But it still opens in iPhone 4S mode (default I guess).

I’ve also tried:-

cordova emulate ios --target=“iPhone-6”

Which didn’t work and bought up a message:-

‘Usage of ‘–family’ is deprecated in 3.x. Use --devicetypeid instead.’
‘Usage of ‘–retina’ is deprecated in 3.x. Use --devicetypeid instead.’

I’m running:
ios-sim - version 3.0.0
cordova - version 3.6.3-0.2.13
ionic - version 1.2.5

Cheers for any pointers


#5

Check this https://github.com/phonegap/ios-sim/issues/111 (I didn’t tried thou)


#6

Brilliant, it worked a treat!

ios-sim launch “app path here” --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPhone-6, 8.0"
ios-sim launch “app path here” --devicetypeid “com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus, 8.0”

Many thanks


#7

Any thoughts on how to make

ionic emulate run
ios-sim launch “app path here” --devicetypeid “com.apple.CoreSimulator.SimDeviceType.iPhone-6, 8.0”

instead?


#8

What did you type as the “app path here”?
Tried this to no avail. Thanks!


#9

Hi, I simply entered the absolute system path to where my app is located e.g users/owner/ionic_projects/test/platforms/ios/test/test.app

So in the terminal it would be:-

ios-sim launch users/owner/ionic_projects/test/platforms/ios/test/test.app --devicetypeid “com.apple.CoreSimulator.SimDeviceType.iPhone-6, 8.0”

Hope that helps


#10

Type
$ ios-sim showdevicetypes
to see list of device names, then set device name you want in ‘–target’ option, ex:
$ ionic emulate ios --target=“iPhone-6-Plus”


#11

Thank you all for the answers.
Thank you trbhoang for the suggestion, it worked great for me, since I am just now getting involved with and learning ionic.