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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:10:32  来源:igfitidea点击:

linker command failed in react native app, using react-native-firebase

xcodereact-native

提问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-toolboxfrom 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 库来修复它:

  1. find the RCTWebsocket project: open -R node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj
  2. Drag it into xcode under your projects Libraries folder
  3. on your project, select your project target, then goto "Build phases" --> "Link Binaries With Libraries" --> "+"
  4. Search for libRCTWebSocket.aand add it
  1. 找到 RCTWebsocket 项目: open -R node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj
  2. 将其拖到项目库文件夹下的 xcode 中
  3. 在您的项目中,选择您的项目目标,然后转到“构建阶段”-->“将二进制文件与库链接”-->“+”
  4. 搜索libRCTWebSocket.a并添加

your project should build now. If libRCTWebSocket.ain 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.aand the libfishhook.abinaries in the YourProject -> Targets -> YourProject -> Link Binary With Librarieslist

我在 iOS 12、XCode 10 上遇到了类似的问题。对于那些可能有帮助的人(并避免像我一样浪费时间..),我必须在 YourProject -> Targets -> YourProject -> list 中添加libRCTWebSocket.alibfishhook.a二进制文件Link Binary With Libraries

回答by Build3r

I was able to build the app by placing libRCTWebSocket.a before libReact.

我能够通过在 libReact 之前放置 libRCTWebSocket.a 来构建应用程序。

xcode linker settings

xcode 链接器设置