Skip to content

Commit c0acc80

Browse files
committed
fix: xcode 10.2 compatibility for run-ios command
parse output of simulator list provided by xcode 10.2 In Xcode 10.2, the output of `xcrun simctl list --json devices` has changed to include a namespace within each version group. This commit makes a backwards-compatible adjustment to account for this change in format. To illustrate: Before ====== ``` { "devices": { "iOS 10.0": [ ... ] } } ``` After ===== ``` { "devices": { "com.apple.CoreSimulator.SimRuntime.iOS-10-0": [ ... ] } } ```
1 parent b33d079 commit c0acc80

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: packages/cli/src/runIOS/findMatchingSimulator.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ function findMatchingSimulator(simulators, simulatorString) {
3939
}
4040

4141
let match;
42-
for (const version in devices) {
42+
for (const versionDescriptor in devices) {
43+
let version = versionDescriptor;
44+
45+
if ((/^com\.apple\.CoreSimulator\.SimRuntime\./g).test(version)) {
46+
// Transform "com.apple.CoreSimulator.SimRuntime.iOS-12-2" into "iOS 12.2"
47+
version = version.replace(/^com\.apple\.CoreSimulator\.SimRuntime\.([^-]+)-([^-]+)-([^-]+)$/g, '$1 $2.$3');
48+
}
49+
4350
// Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc)
4451
if (!version.startsWith('iOS') && !version.startsWith('tvOS')) {
4552
continue;

0 commit comments

Comments
 (0)