React Native iOS构建失败

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了React Native iOS构建失败相关的知识,希望对你有一定的参考价值。

由于某些原因,当我尝试构建并运行我的应用程序时,出现很多错误

CompileC /Users/EcoSurvUser/Desktop/eco-surv/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/third-party.build/Objects-normal/x86_64/vlog_is_on.o /Users/EcoSurvUser/Desktop/eco-surv/node_modules/react-native/third-party/glog-0.3.4/src/vlog_is_on.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    CompileC /Users/EcoSurvUser/Desktop/eco-surv/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/third-party.build/Objects-normal/x86_64/utilities.o /Users/EcoSurvUser/Desktop/eco-surv/node_modules/react-native/third-party/glog-0.3.4/src/utilities.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)

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

有趣的部分是它可以在我的朋友计算机上工作

更新:

我的ios / build / dinfo.plist看起来像:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>LastAccessedDate</key>
    <date>2018-06-06T10:17:34Z</date>
    <key>WorkspacePath</key>
    <string>/Users/EcoSurvUser/Desktop/eco- 
    surv/ios/ecosurv.xcodeproj</string>
</dict>
</plist>
答案

您可以尝试如下

您需要同时删除ios,android和node module文件夹。 运行以下命令

> npm install //to get the node module folder

> react-native upgrade //to get android and ios folder

> react-native link // for linking the libraries

> react-native run ios/android
另一答案

您能否在ios / yourProjectName / info.plist中检查您是否为Info.plist,以查看是否有CFBundlerIdentifier?

如果一切顺利,您还可以跑步吗

sudo lsof -i :8081

如果找到结果,例如:

node 7601 XXXX 23u IPv6 0xc6b249599e5f1169 0t0 TCP *:sunproxyadmin (LISTEN)

杀死进程

kill -9 7601

然后再试一次 :

react-native run-ios

以上是关于React Native iOS构建失败的主要内容,如果未能解决你的问题,请参考以下文章

在 Mac M1 上 React Native ios 构建失败

React Native ios 构建突然失败

构建失败:如何解决 React Native iOS 虚拟设备应用构建失败、CompileSwift 和 CompileC 失败?

React Native 和 RNFirebase iOS 版本构建失败

React Native iOS 构建失败“无法执行命令:分段错误:11”

RNAppAuth,iOS 构建失败,未知类型名称“命名空间”,react-native-app-auth