Important note for targeting iOS Emulators in Cordova

This post is more than 2 years old.

With the recent changes to iOS9, I've had to do more testing in iOS 8.4 versus 9.0 when working on Ionic/Cordova applications. It is relatively easy to switch which emulator you are using if you use the --target argument in the CLI:

cordova emulate ios --target="something"

Of course, the question is, what value do you use for "something"? My coworker Carlos Santana has an excellent answer over on Stackoverflow. Basically if you run:


You will get a list of valid targets for your simulator. As an aside, how many of you ever dig around in your platforms folder? Did you even know this tool existed? Should I write up an exploration of this folder? Ok, stay on target, Raymond.

Running this command will give you output that looks like this:

iPad-Air, 8.4
iPad-Air, 8.4
iPad-Air, 8.4
iPad-Air, 9.0
iPhone-6, 8.4
iPhone-6, 8.4
iPhone-6, 8.4
iPhone-6, 9.0
iPhone-6-Plus, 8.4
iPhone-6-Plus, 8.4
iPhone-6-Plus, 8.4
iPhone-6-Plus, 9.0

The list above is about half of my list and your list will be different. Ok, problem solved, right? Not so fast. What happens when you try to target the 8.4 version of the iPhone?

cordova emulate ios --target="iPhone-6, 8.4"


Wtf? Confusing, right? If you keep reading on that StackOverflow page, you come to this answer by Ruslan Soldatenko. He points out that the platforms/ios/cordova/lib/run.js file has a specific list of allowed targets. I'm sure there is a good reason for this. Maybe the Cordova CLI doesn't want to keep asking the system for valid targets. Either way, if you open it up, you will find a line like this:

var validTargets = ['iPhone-4s', 'iPhone-5', 'iPhone-5s', 'iPhone-6-Plus', 'iPhone-6',
        'iPad-2', 'iPad-Retina', 'iPad-Air', 'Resizable-iPhone', 'Resizable-iPad'];

Add "iPhone-6, 8.4" to the end of the array and you are good to go... for this project only. You'll need to modify this line in every project you work with where you need to target different iOS versions.

As an aside, this (obviously) applies to Ionic and their CLI.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Adam Presley posted on 10/13/2015 at 3:27 PM

Heh I ran into this problem as well. Nicely documented sir.

Comment 2 by Tommy-Carlos Williams posted on 10/13/2015 at 8:22 PM

If it's just about selecting the other versions (8.4 vs 9.0, etc), then the line after that is the issue.

Try changing it from:

if (!(args.device) && && validTargets.indexOf( < 0 ) {


if (!(args.device) && && validTargets.indexOf(',')[0]) < 0 ) {

It has been fixed, there just hasn't been a new release:

The bad news, iPhone-6S will also have to be added to the validTargets, and that hasn't been done yet.

Comment 3 (In reply to #2) by Raymond Camden posted on 10/13/2015 at 8:25 PM

Is there a technical reason it can't just use the output of the *other* program? Or - not check at all and maybe just issue a warning "This target does not *seem* to be supported."

Comment 4 (In reply to #3) by Tommy-Carlos Williams posted on 10/13/2015 at 8:28 PM

Yeah, I honestly don't know. The up side is that these things usually only need to be updated once a year, heh. Maybe that's why.

Comment 5 by Sam Croft posted on 3/11/2016 at 2:42 PM

Thanks for sharing this, Raymond!

Comment 6 (In reply to #5) by Raymond Camden posted on 3/11/2016 at 2:59 PM

You are welcome.

Comment 7 (In reply to #0) by Raymond Camden posted on 12/7/2016 at 4:40 PM

Was it a valid result when you ran the list command?

Comment 8 (In reply to #0) by Raymond Camden posted on 12/8/2016 at 7:09 PM

Um - if everything broke, I'm not sure what to tell you. Obviously this post may not work as described now since it is over a year old.

Comment 9 by Manuel Castillo posted on 1/10/2017 at 2:09 PM

Hi, I can't running emulator. The process stop before checking the dependences and not continue.
No show any error, only freeze.

Comment 10 (In reply to #9) by Raymond Camden posted on 1/10/2017 at 3:05 PM

Not sure what to suggest if you don't have an error. I'd consider filing a bug report on the Apache Cordova project.