6

我正在尝试使用此存储库构建我的第一个 iOS 应用程序: https ://github.com/pmusaraj/discourse-mobile-single-site-app

构建时,我收到一个错误,无法继续前进。我是一个绝对的菜鸟,会花很长时间在这上面,但不知道我是否已经在代码中达到了一个失败点,我可以通过一些简单的调整来超越,或者我是否必须等待我的问题(打开于回购)由开发人员解决。我认为开发人员正忙于其他项目,可能没有时间提供帮助。

也许我的软件太新了?我应该尝试对 react-native 和 XCode 进行版本控制吗?我可以降级到 XCode 9.2(2017 年 12 月到 2018 年 3 月的版本)和 react-native 到 0.53.0(2018 年 1 月的版本)。
我的机器:
Mac OSX:10.14.6
react-native-cli:2.0.1
react-native:0.58.6
XCode:10.3(build 10G8)

问题:info.plist 文件不能很好地与构建器配合使用。在 /ios/DiscoSingle/Info.plist 中,我看到 CFBundleIdentifier 正确定义为:

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

这对我来说是正确的。

这是运行时的错误react-native ios-build

The following build commands failed:
    Ld /Users/user919021/Desktop/discourse/ios/build/Build/Products/Debug-iphonesimulator/DiscoSingle.app/DiscoSingle normal x86_64
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/DiscoSingle.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/DiscoSingle.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist


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

    at checkExecSyncError (child_process.js:629:11)
    at Object.execFileSync (child_process.js:647:13)
    at Promise.then (/Users/user919021/Desktop/discourse/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)
4

3 回答 3

3

根据我的经验,您的 git 中的 Bundle Identifier 名称被忘记填写了。因此,您必须在 info plist> 签名和功能中添加该捆绑标识符名称。您可以添加类似:com.habiesmart.myapps 等。就像这样,然后尤里卡!你可以运行那个项目!

这张图片可以帮助你

最好的,哈比。

于 2020-03-04T09:32:15.143 回答
3

错误原因:就我而言,我移动了破坏构建的 info.plist。将 info.plist 移回后,错误继续发生。

解决方案:关于 bundle 的一切似乎都是正确的。修复是更改 info.plist 中不相关的条目并运行构建。这导致该过程自行纠正。然后我将更改后的 info.plist 条目设置回其原始设置,并且再次成功运行构建。

(FWIW,我选择“应用程序支持间接输入......”来改变)

于 2022-02-01T20:30:33.183 回答
0

就我而言,这与我的主故事板或启动屏幕有关。我想我在文件系统上删除了它们,然后尝试构建一个项目,但最后得到了错误。在我删除 Xcode 项目中的这些文件并将它们添加回来之后,它开始在模拟器上运行。

于 2022-01-30T10:02:17.290 回答