我有这个错误
❌ 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)
这是我做的
- 我清理并重建仍然有错误
- rm -f ~/Library/Developer/Xcode/DerivedData/ModuleCach
最佳答案
首先,确保 Libraries -> React.xcodeproj -> ThirdParty -> double-conversion
存在并且正在从中生成静态库,如下所示:
然后,如果您使用的是 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/