Peter G.
Peter G.

Reputation: 8034

React Native: Bundle Identifier does not exist

I have a project in React Native that has two different build schemes and uses cocoapods. To compile it I run:

react-native run-ios --scheme="RNProject-(SCHEME_NAME)"

The resulting apps are for example:

./build/Build/Products/Debug/iphonesimulator/RNProject-customer1.app
./build/Build/Products/Debug/iphonesimulator/RNProject-customer2.app

I tried different ways to solve it:

Console:

** BUILD SUCCEEDED **

Installing build/Build/Products/Debug-iphonesimulator/RNProject.app
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
child_process.js:509
    throw err;
    ^

Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/RNProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

    at checkExecSyncError (child_process.js:486:13)
    at Object.execFileSync (child_process.js:506:13)
    at ChildProcess.xcodeBuildProcess.on.code (node_modules/react-native/local-cli/runIOS/runIOS.js:109:36)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:852:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)

Upvotes: 1

Views: 4165

Answers (2)

Micheal Vu
Micheal Vu

Reputation: 1478

My solution is similar:

  1. open ./node_modules/react-native/local-cli/runIOS.js file
  2. change the build path from:

    const getBuildPath = function(configuration = 'Debug', appName, isDevice) {  
      return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
    };
    

to

    const getBuildPath = function(configuration = 'Debug', appName, isDevice) {  
      return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
    };
  • remove "Build" in the path.

I'm using Xcode-beta 8.2

Upvotes: 0

Peter G.
Peter G.

Reputation: 8034

The problem was with how React Native names labels the executable files.

My Xcode project created two executable files with different names based on Xcode project settings.

React Native on the other hand forms the executable filename from .xcworkspace filename in this script (./node_modules/react-native/local-cli/runIOS/runIOS.js:57):

const inferredSchemeName = path.basename(xcodeProject.name, path.extname(xcodeProject.name));

The two approaches are different and lead to two different executable file names (e.g. Xcode build/Build/Products/Debug-iphonesimulator/RNProject-customer1.app vs React Native build/Build/Products/Debug-iphonesimulator/RNProject.app).

I had set custom value for inferredSchemeNameto match the filename created by Xcode.

Upvotes: 1

Related Questions