ios - 切换到调试时体系结构 x86_64 的 undefined symbol

标签 ios xcode react-native cocoapods

当我将方案切换为调试时,出现以下错误。在 Release 中,我可以毫无问题地构建。

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTReconnectingWebSocket", referenced from:
      objc-class-ref in libReact.a(RCTPackagerConnection.o)
  "_OBJC_CLASS_$_RCTSRWebSocket", referenced from:
      objc-class-ref in libReact.a(RCTInspectorPackagerConnection.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Pod 文件:

target "xy" do
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'CxxBridge' # Include if RN >= 0.47
  ]
  pod 'DoubleConversion', podspec: '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'Folly', podspec: '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'GLog', podspec: '../node_modules/react-native/third-party-podspecs/GLog.podspec'


  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'Firebase/Core'
  pod 'GoogleToolboxForMac/NSData+zlib'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
  pod 'react-native-fetch-blob', :path => '../node_modules/react-native-fetch-blob'
  pod 'RNShare', :path => '../node_modules/react-native-share'
  pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk/ios'
  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'

end

最佳答案

您可以尝试将它添加到您的 pod 'React' 部分,如下所示:

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

不要忘记运行 pod install

如果这不起作用:

  • 打开 XCode,
  • 点击您的项目根
  • 选择你的目标
  • 标签:构建阶段
  • 将二进制文件与库链接
  • +(在本节的按钮上)和
  • 添加libRCTWebsocket.a

这应该可以解决它。

关于ios - 切换到调试时体系结构 x86_64 的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47582521/

相关文章:

ios - 如何在 Swift 中使 TableView 的标题 View 可点击

ios - Swift 2.0 'unexpected trailing closure' 惰性变量分配错误

ios - iOS app 提交到 iTunesConnect 内测时,是否需要分发证书

reactjs - React-Native : How to get callback of api call in another class

ios - React Native-打包器未启动

ios - 带主键的多对一(唯一约束)

ios - 在 iOS 8 上使用自定义 UI 动画显示和关闭共享扩展

c - 使用 "extern"声明没有参数的函数

ios - UIButtons 在横向和较小的设备上被压扁

reactjs - react native : where to place global state variables