From c58e19ef3397db89ba0a8705d3fcafa17cf4aad7 Mon Sep 17 00:00:00 2001 From: Paulus Esterhazy Date: Wed, 19 Apr 2017 11:19:05 -0700 Subject: [PATCH] Fix run-ios when specifying a scheme as cli arg Summary: The cli arg `--scheme` allows you to override the inferred scheme. The runOnDevice command takes this override into account, but run-ios doesn't. This commit fixes this discrepancy. Thanks for submitting a PR! Please read these instructions carefully: - [x] Explain the **motivation** for making this change. - [x] Provide a **test plan** demonstrating that the code is solid. - [x] Match the **code formatting** of the rest of the codebase. - [x] Target the `master` branch, NOT a "stable" branch. Currently if a custom scheme is specified, `run-ios` will fail with the following message ``` Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist ``` This PR fixes this. Tested manually from CLI. Closes https://github.com/facebook/react-native/pull/13548 Differential Revision: D4914531 Pulled By: javache fbshipit-source-id: 071710947e90e6194e0229751e33068565e010b2 --- local-cli/runIOS/runIOS.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/local-cli/runIOS/runIOS.js b/local-cli/runIOS/runIOS.js index 8463687bd..01d83d900 100644 --- a/local-cli/runIOS/runIOS.js +++ b/local-cli/runIOS/runIOS.js @@ -47,7 +47,7 @@ function runIOS(argv, config, args) { } else if (args.udid) { return runOnDeviceByUdid(args, scheme, xcodeProject, devices); } else { - return runOnSimulator(xcodeProject, args, inferredSchemeName, scheme); + return runOnSimulator(xcodeProject, args, scheme); } } @@ -66,7 +66,7 @@ function runOnDeviceByUdid(args, scheme, xcodeProject, devices) { } } -function runOnSimulator(xcodeProject, args, inferredSchemeName, scheme){ +function runOnSimulator(xcodeProject, args, scheme){ return new Promise((resolve) => { try { var simulators = JSON.parse( @@ -94,7 +94,7 @@ function runOnSimulator(xcodeProject, args, inferredSchemeName, scheme){ .then((udid) => buildProject(xcodeProject, udid, scheme, args.configuration, args.packager)) .then((appName) => { if (!appName) { - appName = inferredSchemeName; + appName = scheme; } let appPath = getBuildPath(args.configuration, appName); console.log(`Installing ${appPath}`);