ios - ld : library not found for -lDoubleConversion React Native 0. 59

标签 ios react-native

我有这个错误

❌  ld: library not found for -lDoubleConversion

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)


error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening App.xcworkspace

** BUILD FAILED **

The following build commands failed:
    Ld /Users/mohamedelmi/workspace/elmi/food-frontend/ios/build/App/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/x86_64/App normal x86_64
(1 failure)

这是我做的

  1. 我清理并重建仍然有错误
  2. rm -f ~/Library/Developer/Xcode/DerivedData/ModuleCach

最佳答案

首先,确保 Libraries -> React.xcodeproj -> ThirdParty -> double-conversion 存在并且正在从中生成静态库,如下所示:

enter image description here

然后,如果您使用的是 cocoapods,请确保将 DoubleConversion 添加到您的 Podfile:

target 'MyApp' do
  pod 'React', :path => "../node_modules/react-native", :subspecs => [
    'Core',
    'CxxBridge',
    'DevSupport',
    # the following ones are the ones taken from "Libraries" in Xcode:
    'RCTAnimation',
    'RCTActionSheet',
    'RCTBlob',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]
  pod 'yoga', :path => "../node_modules/react-native/ReactCommon/yoga"

  # Here it goes
  pod 'DoubleConversion', :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"

  pod 'glog', :podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec"
end

最后,如果到目前为止这些都不起作用,您可以手动运行一个脚本 为了解决 React 的第三方依赖。

只需转到 node_modules/react-native 并输入:

$ ./scripts/ios-install-third-party.sh

重要:始终在 node_modules/react-native 中运行它。因为,据我所知,该脚本使用相对路径来存储第三方的源代码,而 React Native 将始终在 node_modules/react-native/third-party 中查找它。因此,请确保在正确的位置运行它。

注意:此脚本可能已作为项目的构建阶段运行。

关于ios - ld : library not found for -lDoubleConversion React Native 0. 59,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55239646/

相关文章:

android - React-Native 安卓 | JScode 在 APK 中的位置

ios - 禁用 UITextView 中的水平滚动

ios - NSURLConnection 和多个异步请求 - 它是否会干扰正在传输的数据?

ios - 在 MTLBuffer 的一部分上运行计算内核?

ios - AlamoFire 在某些页面上未被识别,但在其他页面上可以识别

javascript - jQuery 显示和隐藏在 iPad 或 iPhone 上不起作用

react-native - React Native Expo 打开和关闭音频

javascript - Flatlist 不会显示 json 中的图像(React Native)

react-native - 在 Info.plist 中找不到排毒字段 CFBundleIdentifier

javascript - 为什么我的列表项调用了它不应该调用的函数?