Skip to content

Commit 9736ddc

Browse files
grabboufacebook-github-bot
authored andcommitted
Fix run-ios not turning on Simulator app
Summary: Right now, `run-ios` will "boot" Simulator in the headless mode in the background, as long as the Simulator.app is not running. It is exactly what "detox" does - it executes your test suite in the background. It seems to me that the author of this change was testing it with `Simulator.app` open. In order to fix this behavior, we have to make sure it runs before we attempt booting. This passed through the release process since we don't use `run-ios` there (it recommends turning on XCode and testing manually which is what I have done recently too). Differential Revision: D7535693 Pulled By: hramos fbshipit-source-id: 881db7740ace805ecefb98bfdb660e32aafd4664
1 parent c2b9be0 commit 9736ddc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

local-cli/runIOS/runIOS.js

+18
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ function runOnSimulator(xcodeProject, args, scheme) {
112112
if (!selectedSimulator) {
113113
throw new Error(`Could not find ${args.simulator} simulator`);
114114
}
115+
116+
/**
117+
* Booting simulator through `xcrun simctl boot` will boot it in the `headless` mode
118+
* (running in the background).
119+
*
120+
* In order for user to see the app and the simulator itself, we have to make sure
121+
* that the Simulator.app is running.
122+
*
123+
* We also pass it `-CurrentDeviceUDID` so that when we launch it for the first time,
124+
* it will not boot the "default" device, but the one we set. If the app is already running,
125+
* this flag has no effect.
126+
*/
127+
child_process.execFileSync('open', [
128+
'/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app',
129+
'--args',
130+
'-CurrentDeviceUDID',
131+
selectedSimulator.udid
132+
]);
115133

116134
if (!selectedSimulator.booted) {
117135
const simulatorFullName = formattedDeviceName(selectedSimulator);

0 commit comments

Comments
 (0)