简体   繁体   中英

Detox: field CFBundleIdentifier not found inside Info.plist

I've got a ReactNative 0.63.2 project. It runs on the simulator, it runs on the physical device. Decided to get started with Detox now.

When running the sample test, I run into this error:

Error: field CFBundleIdentifier not found inside Info.plist of app binary at /Users/jesus/Documents/projects/appname/ios/build/Build/Products/Debug-iphonesimulator/Appname.app

In my Info.plist :

<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>

My .detoxrc.json :

{
  "testRunner": "jest",
  "runnerConfig": "e2e/config.json",
  "configurations": {
    "ios": {
      "type": "ios.simulator",
      "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/Appname.app",
      "build": "xcodebuild -project ios/Appname.xcodeproj -scheme Appname -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
      "device": {
        "type": "iPhone 11"
      }
    },
    "android": {
      "type": "android.emulator",
      "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
      "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
      "device": {
        "avdName": "Pixel_API_28_AOSP"
      }
    }
  }
}

I checked that there is a Bundle Identifier set in Xcode > General. There is also a field under Build Settings > Packaging which has app.appname set properly.

This is unrelated issue to Detox.

Check the Info.plist inside your.app bundle (not the Info.plist in your source code). Most likely, your bundle is broken. iOS requires a valid bundle identifier for every app. The PRODUCT_BUNDLE_IDENTIFIER might not be correctly defined inside your Xcode build settings.

I had the same problem.

I had problems building and solved them by copy pasting the command that react native uses when running react-native run-ios, which had -destination id="{MyprojectID}" In doing so I removed -derivedDataPath iOS/build, I solved it by adding this again, together with -sdk iphonesimulator, with my build command looking like this:

xcodebuild -workspace iOS/{AppName}.xcworkspace -configuration Debug -scheme {AppName} -sdk iphonesimulator -derivedDataPath ios/build -destination id={MyprojectID}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM