apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.15k stars 986 forks source link

iOS simulator targets are not prioritized by SDK #833

Open colbymelvin opened 4 years ago

colbymelvin commented 4 years ago

Bug Report

Problem

When running cordova emulate ios without a target, the deployToSim method just picks the last iPhone emulator specified by listEmulatorImages.

This can be burdensome on a machine with lots of installed images for varying iOS versions.

What is expected to happen?

When not specifying a target, I would expect cordova emulate ios to prioritize by SDK version when possible.

Given the following list of emulator images, I would expect the first 13.X image found to take precedence and be used as the default target:

iPhone-8, 13.4
...
iPhone-8-Plus, 13.4
...
iPhone-11, 13.4
...
iPhone-11-Pro, 13.4
...
iPhone-11-Pro-Max, 13.4
...
iPhone-SE--2nd-generation-, 13.4
iPhone-5s, 11.4
...
iPhone-6-Plus, 11.4
...
iPhone-6, 11.4
...
iPhone-6s, 11.4
...
iPhone-6s-Plus, 11.4
...
iPhone-SE, 11.4
...
iPhone-7, 11.4
...
iPhone-7-Plus, 11.4
...
iPhone-X, 11.4
...
iPhone-XS, 12.0
...
iPhone-XS-Max, 12.0
...
iPhone-XR, 12.1

What does actually happen?

Given the following list of emulator images, the last iPhone emulator image is used (iPhone-XR, 12.1):

iPhone-8, 13.4
...
iPhone-8-Plus, 13.4
...
iPhone-11, 13.4
...
iPhone-11-Pro, 13.4
...
iPhone-11-Pro-Max, 13.4
...
iPhone-SE--2nd-generation-, 13.4
iPhone-5s, 11.4
...
iPhone-6-Plus, 11.4
...
iPhone-6, 11.4
...
iPhone-6s, 11.4
...
iPhone-6s-Plus, 11.4
...
iPhone-SE, 11.4
...
iPhone-7, 11.4
...
iPhone-7-Plus, 11.4
...
iPhone-X, 11.4
...
iPhone-XS, 12.0
...
iPhone-XS-Max, 12.0
...
iPhone-XR, 12.1

Information

Command or Code

Environment, Platform, Device

Version information

Checklist

colbymelvin commented 4 years ago

I am willing to work on and submit a PR for this -- LMK!