【问题标题】:React Native: ":CFBundleIdentifier", Does Not ExistReact Native:“:CFBundleIdentifier”,不存在
【发布时间】:2019-05-30 18:30:57
【问题描述】:

似乎这个错误对每种情况都非常具体,因为我已经尝试了这篇文章中的所有内容: Print: Entry, ":CFBundleIdentifier", Does Not Exist

我也尝试了这篇文章中的几乎所有内容,我在 2018 年 5 月 22 日停下来,其中 auxilioivy 推荐了一个符号链接: https://github.com/facebook/react-native/issues/7308

在我做一个符号链接之前,我会联系你们所有人。

升级我的 React Native 不是一种选择。

我有以下几点:

"react": "16.2.0",
"react-native": "0.53.3",
"react-native-xcode-packager": "^0.1.0",

"detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/NFIBEngage.app",
        "build": "xcodebuild -workspace ios/NFIBEngage.xcworkspace -configuration Debug -scheme NFIBEngage -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "name": "iPhone 6"
      }
    },

错误是指我的ios/AppName-tvOS/Info.plist:

<key>CFBundleIdentifier</key>
    <string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>

实际的错误是这样说的:

fatal error: 'SplashScreen.h' file not found
#import "SplashScreen.h"
        ^~~~~~~~~~~~~~~~
1 error generated.



** BUILD FAILED **


The following build commands failed:
    CompileC build/Build/Intermediates.noindex/NFIBEngage.build/Debug-iphonesimulator/PROD.build/Objects-normal/x86_64/AppDelegate.o NFIBEngage/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/NFIBEngage.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

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

闪屏错误与AppDelegate.m中的这一行有关:

#import "SplashScreen.h"

但我不知道这有什么关系。我正在使用 XCode 10.1 和 High Sierra OSX 的模拟器。另外,如果我转到 File -> Project Settings

在高级选项卡中我有:

我按照这里的建议之一尝试的最后一件事: https://github.com/facebook/react-native/issues/21382

给了我这个:

cd ios
➜  ios git:(release/3.6.2_build) ✗ pod install
zsh: command not found: pod

预感我想在重新安装相同版本然后运行 ​​react-native link react-native-splash-screen 后尝试删除并重新安装 react-native-splash-screen 我不再收到有关启动画面的错误,而是收到此错误:@ 987654336@

这是否意味着闪屏错误已解决,现在我正在处理其他问题,例如 Sentry 身份验证令牌问题?

上述错误是否意味着我需要auth.token?如果是,这与安全令牌有什么不同?

【问题讨论】:

  • Print: Entry, ":CFBundleIdentifier", Does Not Exist 通常是构建失败的输出。正如您在问题中指出的那样,问题在于 AppDelegate.m 中的行,它正在导入 #import "SplashScreen.h"。找出这个文件应该在哪里以及为什么 xcode 构建工具找不到它。
  • @hyb175,谢谢你提供这个线索。我确实开始研究它,但并没有考虑到这个问题。
  • 如果你有兴趣,仅供参考,cocoapods 是一个用于 ios 原生依赖的包管理工具,它有命令 pod,所以除非你使用 cocoapods 来管理你的 ios 依赖,pod在这里不相关。
  • @hyb175,虽然我在查看 &lt;key&gt;CFBundleIdentifier&lt;/key&gt; &lt;string&gt;org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)&lt;/string&gt; 引用的内容时确实看到这里引用了它 PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";,但从未使用过 cocoapods 来管理包。
  • @hyb175,我预感我会尝试删除并重新安装react-native-splash-screen,然后重新安装相同的版本,然后运行react-native link react-native-splash-screen 我不再收到有关启动画面的错误,而是收到此错误:caused by: sentry reported an error: You do not have permission to perform this action. (http status: 403) 这可能是闪屏错误已解决,现在我正在处理其他问题,例如 Sentry 身份验证令牌问题?

标签: xcode react-native


【解决方案1】:

因此,我从一位在这里发表评论的同事那里得到的线索,我发现了这篇文章: https://medium.com/handlebar-labs/how-to-add-a-splash-screen-to-a-react-native-app-ios-and-android-30a3cec835ae

我决定卸载react-native-splash-screen@3.0.6 并像这样重新安装它:

npm install react-native-splash-screen@3.0.6
react-native link react-native-splash-screen

果然闪屏错误消失了。

【讨论】:

    猜你喜欢
    • 2018-06-05
    • 1970-01-01
    • 2018-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-24
    • 2017-11-10
    相关资源
    最近更新 更多