Selecting an iOS emulator image to test on

I’ve been racking my brain on how to select a specific iOS emulator device model to test my Ionic project in. Then I stumbled onto this very useful StackOverflow post, and I am just linking to it here as (a) a service for everyone else, and also (b) so I have a bookmark that I can revisit during my next testing session.

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

Basically, to get a list of available device images on your system that you can test against, run:

$ ./platforms/ios/cordova/lib/list-emulator-images 

On my system, this is the list I get:

iPhone-4s
iPhone-5
iPhone-5s
iPhone-6-Plus
iPhone-6
iPad-2
iPad-Retina
iPad-Air
Resizable-iPhone
Resizable-iPad
$

Now, if I wanted to test again, say the iPhone 6, I would type in:

$ ionic emulate ios --target="iPhone-6"

Similarly, if I wanted to test in an older iPad emulator, I would type in:

$ ionic emulate ios --target="iPad-2"

I find the emulators very useful for creating the screen shots to be uploaded to the app store. I run up my app on each device model and use [Command-S] to save the screen shots to a folder and then upload to the App Store and they are perfect dimensions.

Hope this helps others too.

10 Likes