Skip to content

Commit

Permalink
Make run-ios command play nicely with multiple Xcode versions (facebo…
Browse files Browse the repository at this point in the history
…ok#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#19781

Differential Revision: D8475915

Pulled By: TheSavior

fbshipit-source-id: d607f1f9eb9e565d4a017c21de50b5e569d171f9
  • Loading branch information
futuun authored and macdoum1 committed Jun 28, 2018
1 parent 9199a65 commit 293c517
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion local-cli/runIOS/runIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,11 @@ function runOnSimulator(xcodeProject, args, scheme) {
* it will not boot the "default" device, but the one we set. If the app is already running,
* this flag has no effect.
*/
const activeDeveloperDir = child_process
.execFileSync('xcode-select', ['-p'], {encoding: 'utf8'})
.trim();
child_process.execFileSync('open', [
'/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app',
`${activeDeveloperDir}/Applications/Simulator.app`,
'--args',
'-CurrentDeviceUDID',
selectedSimulator.udid,
Expand Down

0 comments on commit 293c517

Please sign in to comment.