我会在调试方案时会出现以下错误。在发行中,我可以构建而没有任何问题。
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
这应该修复。