Fresh React Native项目失败:条目“:CFBundleIdentifier”不存在

时间:2019-11-22 19:08:23

标签: ios react-native cfbundleidentifier

我正在尝试仅通过遵循此处的指南来建立一个新的React Native项目:https://facebook.github.io/react-native/docs/getting-started

我可以从Xcode很好地构建和运行它,只得到一些“语义警告”。

虽然我运行yarn react-native run-ios时遇到以下错误:

Leos-MacBook-Pro:citymysteryrn leo$ yarn react-native run-ios
yarn run v1.19.1
$ /Users/leo/Projekt/ReactNative/CityMysteryRN/node_modules/.bin/react-native run-ios
info Found Xcode workspace "CityMysteryRN.xcworkspace"
info Building (using "xcodebuild -workspace CityMysteryRN.xcworkspace -configuration Debug -scheme CityMysteryRN -destination id=85422E57-5311-43D4-9292-E02982FB7B67 -derivedDataPath build/CityMysteryRN")
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
info Installing "DerivedData/Build/Products/Debug-iphonesimulator/CityMysteryRN.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
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/CityMysteryRN.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
. Run CLI with --verbose flag for more details.
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/CityMysteryRN.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

    at checkExecSyncError (child_process.js:621:11)
    at Object.execFileSync (child_process.js:639:15)
    at runOnSimulator (/Users/leo/Projekt/ReactNative/CityMysteryRN/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js:189:45)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Command.handleAction (/Users/leo/Projekt/ReactNative/CityMysteryRN/node_modules/@react-native-community/cli/build/cliEntry.js:160:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我知道有很多与此相关的问题(和答案),但这似乎是我无法解决的非常广泛的问题。我在Print: Entry, ":CFBundleIdentifier", Does Not Exist上尝试了大多数操作,没有任何运气。

我也尝试过将这个项目与我知道正在运行的较旧的React Native项目进行比较,并确定了以下差异,但是不知道它们是否具有重要意义:

  • third-party中缺少文件夹node_modules/react-native/
  • 构建文件夹包含文件夹ios/build/MyProjectName,其中包含Logsinfo.plist等,而旧项目则直接在ios/build/中包含这些文件和文件夹

这是yarn react-native info

的输出
System:
    OS: macOS 10.15.1
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 296.96 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.13.1 - /var/folders/5k/d42fx4ms6pv83hp9q0f9xvh40000gn/T/yarn--1574448680125-0.03761777189202431/node
    Yarn: 1.19.1 - /var/folders/5k/d42fx4ms6pv83hp9q0f9xvh40000gn/T/yarn--1574448680125-0.03761777189202431/yarn
    npm: 6.12.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    @react-native-community/cli: ^2.9.0 => 2.10.0 
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    react-native-git-upgrade: 0.2.7
    react-native: 0.53.3
/ios/MyProjectName/Info.plist中的

CFBundleIdentifier如下:

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

1 个答案:

答案 0 :(得分:0)

这不是适当的解决方案,但是。

我受够了,备份了MacBook,然后将整个东西擦干净了。现在可以使用了。