Skip to content

Commit 9c102a2

Browse files
futuunfacebook-github-bot
authored andcommitted
Make run-ios command play nicely with multiple Xcode versions (#19781)
Summary: I started using Xcode 10 beta and spotted that even though react-native cli is using cli tools from Xcode 10 for building it tries to open simulator from Xcode 9.4. Turned out that path to simulator app is hardcoded and doesn’t care about active developer directory. 1. You have to have more than one Xcode version (ie. 9.4 and 10 beta). 2. Change active developer directory to Xcode beta (`xcode-select -s /Applications/Xcode-beta.app/Contents/Developer`). 3. Without fix `react-native run-ios` will open simulator from Xcode 9.4, with fix it'll open simulator from active developer directory. [CLI][IOS] [BUGFIX] [./local-cli] - use simulator from active developer directory Closes facebook/react-native#19781 Differential Revision: D8475915 Pulled By: TheSavior fbshipit-source-id: d607f1f9eb9e565d4a017c21de50b5e569d171f9
1 parent 802ca00 commit 9c102a2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

runIOS/runIOS.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,11 @@ function runOnSimulator(xcodeProject, args, scheme) {
160160
* it will not boot the "default" device, but the one we set. If the app is already running,
161161
* this flag has no effect.
162162
*/
163+
const activeDeveloperDir = child_process
164+
.execFileSync('xcode-select', ['-p'], {encoding: 'utf8'})
165+
.trim();
163166
child_process.execFileSync('open', [
164-
'/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app',
167+
`${activeDeveloperDir}/Applications/Simulator.app`,
165168
'--args',
166169
'-CurrentDeviceUDID',
167170
selectedSimulator.udid,

0 commit comments

Comments
 (0)