iOS simulator targets are not prioritized by SDK
- Dominant language
- JavaScript
- Stars
- 2.2k
- Forks
- 1k
- Avg merge
- 12h 11m
- Merged PRs (30d)
- 18
Description
# 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
- [x] I searched for existing GitHub issues
- [ ] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Inspect the deployToSim and listEmulatorImages methods in the Cordova iOS implementation, then reproduce cordova emulate ios without a target using emulator images with different SDK versions. Done means the first available image for the highest SDK version is selected instead of the last iPhone image returned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript, nodejs
- Domain
- cli, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100