xcode 链接器命令在使用 react-native-firebase 响应本机应用程序时失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45504825/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
linker command failed in react native app, using react-native-firebase
提问by Razvan Bretoiu
I developed a react native app using react-native-firebase library.
I want to set my app icon, so I used this library:npm install -g yo generator-rn-toolbox
from here.
我使用 react-native-firebase 库开发了一个 React Native 应用程序。我想设置我的应用程序图标,所以我使用了这个库:npm install -g yo generator-rn-toolbox
从这里开始。
When I try to build the project I receive this error:
当我尝试构建项目时,我收到此错误:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_RCTSRWebSocket", referenced from:
objc-class-ref in libReact.a(RCTInspectorPackagerConnection.o)
"_OBJC_CLASS_$_RCTReconnectingWebSocket", referenced from:
objc-class-ref in libReact.a(RCTPackagerConnection.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How do I fix this ?
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_RCTSRWebSocket", referenced from:
objc-class-ref in libReact.a(RCTInspectorPackagerConnection.o)
"_OBJC_CLASS_$_RCTReconnectingWebSocket", referenced from:
objc-class-ref in libReact.a(RCTPackagerConnection.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我该如何解决 ?
回答by macrozone
I fixed it by manually adding the RCTWebsocket library:
我通过手动添加 RCTWebsocket 库来修复它:
- find the RCTWebsocket project:
open -R node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj
- Drag it into xcode under your projects Libraries folder
- on your project, select your project target, then goto "Build phases" --> "Link Binaries With Libraries" --> "+"
- Search for
libRCTWebSocket.a
and add it
- 找到 RCTWebsocket 项目:
open -R node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj
- 将其拖到项目库文件夹下的 xcode 中
- 在您的项目中,选择您的项目目标,然后转到“构建阶段”-->“将二进制文件与库链接”-->“+”
- 搜索
libRCTWebSocket.a
并添加
your project should build now. If libRCTWebSocket.a
in step 4 is not there, try to build the project first.
您的项目现在应该构建。如果libRCTWebSocket.a
第 4 步中没有,请尝试先构建项目。
回答by Sebastien H.
I had the similar issue for iOS 12, XCode 10.
For those that may help (and avoid losing days like me..),
i had to add the libRCTWebSocket.a
and the libfishhook.a
binaries in the YourProject -> Targets -> YourProject -> Link Binary With Libraries
list
我在 iOS 12、XCode 10 上遇到了类似的问题。对于那些可能有帮助的人(并避免像我一样浪费时间..),我必须在 YourProject -> Targets -> YourProject -> list 中添加libRCTWebSocket.a
和libfishhook.a
二进制文件Link Binary With Libraries