I’m able to emulate up to the 5s size running ionic emulate ios --target="iPhone (Retina 4-inch)"
. Trying the same line with 4.7-inch doesn’t run the iPhone 6 emulator. Is this not available yet or am I just using the wrong command?
Do you have installed Xcode 6 (not beta)?
Yep, I have the latest version of Xcode
To emulate iPhone 6, they first of all have to should fix the following errors on $ ionic emulate ios
:
Usage of '--family' is deprecated in 3.x. Use --devicetypeid instead.
Usage of '--retina' is deprecated in 3.x. Use --devicetypeid instead.
Thees errors are generated because of changes made to ios-sim 3.0, and the document install-emulator, located in /YOUR-APP-NAME/platforms/ios/cordova/lib/ is still referencing deprecated comands in ios-sim 3.0
Using ios-sim 3.0.0:
ios-sim launch platforms/ios/build/emulator/App\\ Name.app --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPhone-6, 8.0"
I knew how to switch the emulator from XCode, but I didn’t think to just open the project in XCode instead of running the ionic command to get the emulator going. I ended up opening my project in platforms/PLATFORM with XCode and choosing iPhone 6 for the device to build on. Problem solved.
Could you elaborate a bite more on this?
I tried setting the build to iOS 8.1 but could not find a target device settings under build settings.
Isen’t this something that should be fixed in the next Ionic update?
hi,
this is just to confirm that ionic emulate ios --target=“iPhone (Retina 4-inch)” works fine for me.
And i’m on 10.9.5 with Xcode 6.1
Confirming this works, thanks for posting!
Running on OSX yosemite with all the latest versions
Run ios-sim showdevicetypes
to check what emulators are available.
SO has @ohh2ahh said before.
ios-sim launch platforms/ios/build/emulator/appName.app --devicetypeid “com.apple.CoreSimulator.SimDeviceType.iPhone-6, 8.0”
I have created a bash script to automate emulating the current project in any installed iOS platform. In order for this to work, you need to have Xcode 6 installed along with the command line tools:
#!/bin/bash
export DEVICES=`ios-sim showdevicetypes 2>&1`
export DEVICES=\"`echo $DEVICES | sed -e 's/ com./" "com./g' | sed -e 's/, /,~/g'`\"
PS3='Please enter your choice: '
options=($DEVICES)
select opt in "${options[@]}"
do
case $opt in
*) echo ios-sim launch "`find . -name *.app -print`" --devicetypeid "`echo $opt | sed -e "s/~/ /g"`" --stderr ./platforms/ios/cordova/console.log --stdout ./platforms/ios/cordova/console.log > tmp.run.file;chmod +x tmp.run.file;./tmp.run.file;rm tmp.run.file;exit;
esac
done
To use this, create a new file called emulateios and paste in the code. Type chmod +x emulateios, then to run it just type ./emulateios from inside a valid project (root level). It’ll present a menu of choices, then run your currently (already built) iOS project in the selected emulator.
Choices look like this:
1) "com.apple.CoreSimulator.SimDeviceType.iPhone-4s,~8.1"
2) "com.apple.CoreSimulator.SimDeviceType.iPhone-5,~8.1"
3) "com.apple.CoreSimulator.SimDeviceType.iPhone-5s,~8.1"
4) "com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus,~8.1"
5) "com.apple.CoreSimulator.SimDeviceType.iPhone-6,~8.1"
6) "com.apple.CoreSimulator.SimDeviceType.iPad-2,~8.1"
7) "com.apple.CoreSimulator.SimDeviceType.iPad-Retina,~8.1"
8) "com.apple.CoreSimulator.SimDeviceType.iPad-Air,~8.1"
9) "com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone,~8.1"
10) "com.apple.CoreSimulator.SimDeviceType.Resizable-iPad,~8.1"
I’ve modified the @burggraf 's script to accept apps that have spaces in their names. It’s not the prettiest but it works.
#!/bin/bash
export DEVICES=`ios-sim showdevicetypes 2>&1`
export DEVICES=\"`echo $DEVICES | sed -e 's/ com./" "com./g' | sed -e 's/, /,~/g'`\"
PS3='Please enter your choice: '
options=($DEVICES)
app="`find ./platforms/ios/build/emulator/ -name *.app -print`"
escaped_app="\"$app\""
echo $app
select opt in "${options[@]}"
do
case $opt in
*) echo ios-sim launch "$escaped_app" --devicetypeid "`echo $opt | sed -e "s/~/ /g"`" --stderr ./platforms/ios/cordova/console.log --stdout ./platforms/ios/cordova/console.log > tmp.run.file;chmod +x tmp.run.file;./tmp.run.file;rm tmp.run.file;exit;
esac
done
Thanks for this mod. Great stuff!
Many thanks for this. Huge help.
Hey, I am using the above script. While it worked sometimes, now every time I see the cordova splash screen and after just a blank white page. Tailing the ./platforms/ios/cordova/console.log I see the following:
2015-03-21 12:02:29.231 myApp[82414:70b] Apache Cordova native platform version 3.6.3 is starting.
2015-03-21 12:02:29.232 myApp[82414:70b] Multi-tasking -> Device: YES, App: YES
2015-03-21 12:02:29.239 myApp[82414:70b] Unlimited access to network resources
2015-03-21 12:02:29.412 myApp[82414:70b] Resetting plugins due to page load.
2015-03-21 12:02:29.420 myApp[82414:70b] Failed to load webpage with error: Could not connect to the server.
Anyone else having these issues? If I run “ionic emulate ios” it works fine… but as soon as I go through this script it stays blank with this error message.