Browse files

Fix installing step of `run-ios` command

To date if you create a new `react-native@0.55.0` project and try to build/run it for iOS via CLI, e.g. by running:

$ react-native init test
$ cd test
$ react-native run-ios --no-packager

the build would succeed, but installing will fail afterwards:


Installing Build/Products/Debug-iphonesimulator/
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier Build/Products/Debug-iphonesimulator/
Print: Entry, ":CFBundleIdentifier", Does Not Exist

This fail happens because `/usr/libexec/PlistBuddy` can't find `Info.plist` file at the provided path.

This is a regression introduced by changes from PR #17963 (accepted in 5447ca6). If you execute test plan from that PR, it would fail.

As per why:

By default, `run-ios` process's working directory is `$PROJECT_DIR/ios`.

According to [this line in `runIOS.js`](, `xcodebuild` places all artifacts in `build` directory.

And the default Xcode paths for products is `Build/Products` (at least of Xcode 9.2 which I use, and Xcode 9.3 which I tested this with also).

So, the required `Info.plist` file is actually being created at `$PROJECT_DIR/ios/build/Build/Products/Debug-iphonesimulator/` (with double `build`, the first from `derivedDataPath` key, the second from default products path). Relatively to `run-ios` process's working directory, the path of the file is `build/Build/Products/Debug-iphonesimulator/`.

PR #17963 changed correct path to incorrect, thus introducing this regression.

If changes from that PR are reverted, CLI doesn't fail on install step.

I catch this error on both existing project and a freshly created test project. I can build/run an app from Xcode just fine, but running from CLI still would fail. The other workaround is to change path of products artifacts in Xcode, which is user settings and therefore can't be commited to a project's repo with VCS.


$ react-native init test
$ cd test
$ react-native run-ios --no-packager

Ensure that it doesn't fail on install step and produce output similar to this:

Installing build/Build/Products/Debug-iphonesimulator/
Launching org.reactjs.native.example.test

[CLI][BUGFIX][local-cli/runIOS/runIOS.js] - Fix failing of `run-ios` command on install step
Closes #18700

Differential Revision: D7555096

Pulled By: hramos

fbshipit-source-id: d877b867e89256f4356f22781d78308affbb9d9c
  • Loading branch information...
angly-cat authored and facebook-github-bot committed Apr 9, 2018
1 parent 43014ea commit 0934c1778f0e3c0b691e1a3ca2df1d486eb905dd
Showing with 1 addition and 1 deletion.
  1. +1 −1 local-cli/runIOS/runIOS.js
@@ -24,7 +24,7 @@ const getBuildPath = function (configuration = 'Debug', appName, isDevice) {
device = 'iphonesimulator';
return `Build/Products/${configuration}-${device}/${appName}.app`;
return `build/Build/Products/${configuration}-${device}/${appName}.app`;
const xcprettyAvailable = function() {
try {

0 comments on commit 0934c17

Please sign in to comment.