ios - React Native iOS 构建失败 : Undefined symbols for architecture x86_64

标签 ios xcode react-native cocoapods react-native-ios

我正在使用 React Native 构建一个 iOS 应用程序。这样做,我安装了 react-native module并按照模块教程配置了我的 iOS xcode 项目(主要是 cocoapods)。现在,当我运行 react-native run-ios ,我得到这个错误堆栈:

Undefined symbols for architecture x86_64:

"_JSNoBytecodeFileFormatVersion", referenced from:

+[RCTJavaScriptLoader loadBundleAtURL:onProgress:onComplete:] in RCTJavaScriptLoader.o

+[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in RCTJavaScriptLoader.o "facebook::react::IRemoteConnection::~IRemoteConnection()", referenced from:

RemoteConnection::~RemoteConnection() in RCTInspector.o "facebook::react::parseTypeFromHeader(facebook::react::BundleHeader const&)", referenced from:

+[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in RCTJavaScriptLoader.o

"facebook::react::customJSCWrapper()", referenced from:

-[RCTDevSettings isJSCSamplingProfilerAvailable] in RCTDevSettings.o

-[RCTDevSettings toggleJSCSamplingProfiler] in RCTDevSettings.o ____ZL11getInstancev_block_invoke in RCTInspector.o

_RCTNSErrorFromJSErrorRef in RCTJSCErrorHandling.o

-[RCTSamplingProfilerPackagerMethod handleRequest:withResponder:] in RCTSamplingProfilerPackagerMethod.o

"facebook::react::systemJSCWrapper()", referenced from:

-[RCTDevSettings isJSCSamplingProfilerAvailable] in RCTDevSettings.o

-[RCTDevSettings toggleJSCSamplingProfiler] in RCTDevSettings.o

_RCTNSErrorFromJSErrorRef in RCTJSCErrorHandling.o

-[RCTSamplingProfilerPackagerMethod handleRequest:withResponder:] in RCTSamplingProfilerPackagerMethod.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

The following build commands failed:

Ld /Users/antoine/R/devlab/ReactNative/medway-twilio/MedwayTwilio/ios/build/Build/Products/Debug-iphonesimulator/React/React.framework/React normal x86_64 (1 failure)



我怀疑这与使用 xcode 将库和框架包含到项目中有关,但我不确定。

这是我的项目目标/构建阶段/链接二进制文件与 xcode 中的库面板的屏幕截图:

Libraries

“MedwayTwilio”是我的项目名称

最佳答案

您是否按照 in the documentation 的描述配置了 CocoaPods 依赖项? ?

此外,您需要添加对 RCTBatchedBridge 子规范(如果使用 0.46)或 RCTCxxBridge(如果更新)的依赖。

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    [...]
    'BatchedBridge', # Include if RN = 0.46
    'CxxBridge' # Include if RN >= 0.47
  ]

关于ios - React Native iOS 构建失败 : Undefined symbols for architecture x86_64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45550228/

相关文章:

ios - 大型 SwiftUI 结构导致内存错误

ios - 哪个占用内存少?一个有 5 个按钮的 View Controller ,还是一个有 5 个项目的 tableview 的 View Controller ?

android - 'react-native run-android' 正在 android 设备中加载旧包

ios - 如何在 UITabBarController 中交换 ViewController

react-native - 使用命令提示符窗口将 gradle 版本从 4.3 升级到 4.4

ios - 如何预构建React Native Pod,或者有没有办法在Podfile中使用远程React Native Pod?

ios - 如何防止每次加载 View Controller 时创建 AVAudioPlayer 类的新实例 - Swift

ios - IOS SDK 使用命令行生成构建时出错?

swift - '强制为任何',但属性是 UIColor 类型

swift - UITextField、textRect、Xcode 版本 10.0、部署目标 12.0、Swift 4.2