Skip to content

Commit

Permalink
Backport fix from react-native-community/cli#138
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Feb 6, 2019
1 parent 98bcfe0 commit 8bddcb6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions local-cli/runIOS/findMatchingSimulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,24 @@ function findMatchingSimulator(simulators, simulatorString) {
}

var match;
for (let version in devices) {
for (const versionDescriptor in devices) {
const device = devices[versionDescriptor];
let version = versionDescriptor;

if ((/^com\.apple\.CoreSimulator\.SimRuntime\./g).test(version)) {
// Transform "com.apple.CoreSimulator.SimRuntime.iOS-12-2" into "iOS 12.2"
version = version.replace(/^com\.apple\.CoreSimulator\.SimRuntime\.([^-]+)-([^-]+)-([^-]+)$/g, '$1 $2.$3');
}

// Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc)
if (!version.includes('iOS') && !version.includes('tvOS')) {
continue;
}
if (simulatorVersion && !version.endsWith(simulatorVersion)) {
continue;
}
for (let i in devices[version]) {
let simulator = devices[version][i];
for (const i in device) {
const simulator = device[i];
// Skipping non-available simulator
if (
simulator.availability !== '(available)' &&
Expand Down

0 comments on commit 8bddcb6

Please # to comment.