Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit dcf908a

Browse files
lebedevcampsafari
authored andcommitted
Fix launching iOS simulator regression
Summary: PR facebook#17284 (accepted in 2ad3407) introduced a couple of regressions. ~1. There's the code:~ ``` .then((appName) => resolve(selectedSimulator.udid, appName)); /* ... */ .then((udid, appName) => { ``` ~~This makes `appName` to be always `undefined` as per `resolve` accepts only 1 argument. This regression causes issues if an app name differs from a scheme name.~ ~This PR fixes this by wrapping both values in an array.~ This was fixed in 589eae1. 2. The code ``` child_process.execFileSync('xcrun', ['simctl', 'boot', selectedSimulator.udid]); ``` makes a simulator *boot*, but the simulator *doesn't launch*. That's a regression, which forces developers to launch simulators by other means (by running a number of elaborate console commands, by running Xcode, or by running a simulator manually). This PR reverts that part of changes. Create a blank project with a name that differs from scheme name. Try to `react-native run-ios` in it. See that a simulator is launched and installing succeeds. Without this changes simulator wouldn't launch, and installing step would fail because of app name mismatch. [CLI][BUGFIX][local-cli/runIOS/runIOS.js] - Fix running on multiple simulators feature regressions Closes facebook#18711 Differential Revision: D7535150 Pulled By: hramos fbshipit-source-id: 5c714231e9977c0c829b6f8c793497cd31cd46b5
1 parent 58e2fde commit dcf908a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

local-cli/runIOS/runIOS.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,12 @@ function runOnSimulator(xcodeProject, args, scheme) {
115115

116116
if (!selectedSimulator.booted) {
117117
const simulatorFullName = formattedDeviceName(selectedSimulator);
118-
console.log(`Booting ${simulatorFullName}...`);
118+
console.log(`Launching ${simulatorFullName}...`);
119119
try {
120-
child_process.execFileSync('xcrun', ['simctl', 'boot', selectedSimulator.udid]);
120+
child_process.spawnSync('xcrun', ['instruments', '-w', selectedSimulator.udid]);
121121
} catch (e) {
122-
throw new Error(
123-
`Could not boot ${args.simulator} simulator. Is there already a simulator running?
124-
Running multiple simulators is only supported from Xcode 9 and up.
125-
Try closing the simulator or run the command again without specifying a simulator.`
126-
);
122+
// instruments always fail with 255 because it expects more arguments,
123+
// but we want it to only launch the simulator
127124
}
128125
}
129126

0 commit comments

Comments
 (0)