Skip to content

Commit

Permalink
Allows a user to specify an xcode scheme name.
Browse files Browse the repository at this point in the history
Summary:When running `react-native run-ios`, this feature allows a user to specify which scheme to run.

My project's scheme name is not the same as the xcode project name. Running `react-native run-ios` would error with the following:

```
± |master ↓95 ✓| → react-native run-ios
Found Xcode workspace Poot.xcworkspace
Launching iPhone 6 (9.2)...
Building using "xcodebuild -workspace Poot.xcworkspace -scheme Poot -destination id=2B3E8AAC-DD61-414C-95BD-F4829A8F7CE6 -derivedDataPath build"
User defaults from command line:
    IDEDerivedDataPathOverride = /Users/mrickert/Documents/project/ios/build

xcodebuild: error: The workspace named "Poot" does not contain a scheme named "Poot". The "-list" option can be used to find the names of the schemes in the workspace.
Installing build/Build/Products/Debug-iphonesimulator/Poot.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was n
Closes facebook#6157

Differential Revision: D3020313

Pulled By: frantic

fb-gh-sync-id: 9d99fa382b3f50045759acea18eff418b15d511d
shipit-source-id: 9d99fa382b3f50045759acea18eff418b15d511d
  • Loading branch information
markrickert authored and Facebook Github Bot 7 committed Mar 7, 2016
1 parent fd3a0ba commit 62788a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion local-cli/runIOS/runIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ function _runIOS(argv, config, resolve, reject) {
type: 'string',
required: false,
default: 'iPhone 6',
}, {
command: 'scheme',
description: 'Explicitly set Xcode scheme to use',
type: 'string',
required: false,
}], argv);

process.chdir('ios');
Expand All @@ -42,6 +47,7 @@ function _runIOS(argv, config, resolve, reject) {
}

const inferredSchemeName = path.basename(xcodeProject.name, path.extname(xcodeProject.name));
const scheme = args.scheme || inferredSchemeName
console.log(`Found Xcode ${xcodeProject.isWorkspace ? 'workspace' : 'project'} ${xcodeProject.name}`);

const simulators = parseIOSSimulatorsList(
Expand All @@ -63,7 +69,7 @@ function _runIOS(argv, config, resolve, reject) {

const xcodebuildArgs = [
xcodeProject.isWorkspace ? '-workspace' : '-project', xcodeProject.name,
'-scheme', inferredSchemeName,
'-scheme', scheme,
'-destination', `id=${selectedSimulator.udid}`,
'-derivedDataPath', 'build',
];
Expand Down

0 comments on commit 62788a1

Please sign in to comment.