当我将方案切换为调试时,出现以下错误。在 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/