我尝试在XCode上构建,但发生ld: library not found for -lDoubleConversion
错误。我可以建立react-native run-ios
。这样可行,但XCode无法构建......
ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / DoubleConversion' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / Folly' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / GTMOAuth2' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / GTMSessionFetcher' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / Google-Maps-iOS-Utils' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / GoogleToolboxForMac' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / Protobuf' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / React' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / glog' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / leveldb-library' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / nanopb' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / react-native-google-maps' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / react-native-maps' ld:警告:找不到选项的目录' -L / Users / xxxxx / Library / Developer / Xcode / DerivedData / xxxxx / Build / Products / Debug-iphonesimulator / yoga' ld:找不到-lDoubleConversion的库 clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
答案 0 :(得分:2)
对我来说,我解决了只打开MyAppName.xcworkspace
而不是MyAppName.xcodeproj
,然后构建的问题。
答案 1 :(得分:2)
在终端而不是XCode上构建项目时发生在我身上,并且发生在CI和笔记本电脑上。
在您正在构建项目app.xcodeproj
而不是工作区app.xcworkspace
的情况下发生这种情况。
因此,您必须在通话中将参数从-project app.xcodeproj
更改为-workspace app.xcworkspace
。请注意,参数名称也会改变,不仅是值。
现在,是一个完整的通话示例。
发件人:
xcodebuild -sdk iphoneos -configuration yourconfig -project app.xcodeproj -scheme yourscheme build -UseModernBuildSystem=YES CODE_SIGN_STYLE=Automatic
收件人:
xcodebuild -sdk iphoneos -workspace app.xcworkspace -workspace app.xcworkspace -scheme yourscheme build -UseModernBuildSystem=YES CODE_SIGN_STYLE=Automatic
答案 2 :(得分:1)
XCode无法找到lDoubleConversion库,您需要将库添加到cocoa pods文件中。
您可以按照以下步骤轻松完成此操作
1.将库文件添加到您的podfile
pod 'DoubleConversion', :podspec => './../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
2.删除Podfile.lock
3.运行pod安装
4.在xcode链接框架和库中添加DoubleConversion.a
5.清理项目并重新构建。
这应该有效。
答案 3 :(得分:1)
升级到RN 0.59后不久,我遇到了这个问题。
对我有用的解决方案是删除ios/build
文件夹,然后执行以下操作:
cd ios
pod install
这样做的时候,我看到关于Folly
的错误,人们建议这样做:
pod deintegrate
pod install
我这样做了,但是仍然会引发关于Folly
的错误,因此我删除了Podfile.lock
,因为吊舱使用的是Folly的旧版本,该版本与RN 0.59不兼容。
注意:我发现某人发帖称不建议删除整个锁定文件。相反,您应该只删除锁定文件中的相关行,即与Folly有关的行。我已经删除了锁定文件,但是一切正常。
我运行了pod update
,它更新了很多内容并成功完成了
下次我运行pod install
时,它会生成一个不错的绿色安装成功列表。
然后我又做一次react-native run-ios
,这是一段时间以来第一次起作用,除了它产生了死亡的红色画面。
所以我从iOS模拟器设备上删除了我的应用,然后运行:
rm -rf node_modules
npm install
killall -9 node
killall -9 node
只是为了杀死Metro Bundler。这是我最喜欢的清扫命令。如果您在计算机上像十二个node.js API一样运行,则可以执行sudo lsof -i :8081
之类的操作,找到Metro Bundler的进程ID,然后通过PID杀死它们。例如,如果看到Metro Bundler正在以PID 27322运行,则执行kill -9 27322
。
然后我在一个独立的终端中运行它:
npm start -- --reset-cache
返回VS Code集成终端:
react-native run-ios
成功了!!!!!!!
然后我跑了
react-native run-android
可以正常工作,但在模拟器设备上卡住了0%,所以我从模拟器上删除了APK,然后再次运行react-native run-android
。
成功了!!!!!!!
答案 4 :(得分:1)
我只是将Deployment Target从10升级到了11.4并有效
答案 5 :(得分:1)
经过 3 天的努力,我找到了以下解决方案。
对我来说,选项 3 成功了。
答案 6 :(得分:0)
你知道有趣吗?事实上,有一半的时间出现此错误时,您可以完全杀死Xcode并重新打开它,问题将消失,有时它仍然存在...我完全相信,这与DerivedData的问题有关比什么都重要。
答案 7 :(得分:0)
有时pod install
中的/ios
很简单,然后关闭xcode并重新打开它并重建。为我工作。
答案 8 :(得分:0)
以下步骤对我有用:
删除use_frameworks!来自ios / Podfile。
target 'AwesomeProject' do
# use_frameworks!
...
end
在iOS / Podfile中添加DoubleConversion吊舱
target 'AwesomeProject' do
# use_frameworks!
...
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
end
透明豆荚。
pod deintegrate
pod rm Podfile.lock
重新安装吊舱
pod install --repo-update --verbose
打开AwesomeProject.xcworkspace并运行您的应用。
希望这对某人有帮助:)
答案 9 :(得分:0)
我的问题是我已使用cocoapods迁移到React Native 0.60,而忽略了更新我的Fastlane构建过程以使用.xcworkspace
而不是.xcproj
文件进行构建。
我观察到可以使用Xcode进行构建和存档,但我的Fastlane构建失败了。菜鸟。
答案 10 :(得分:0)
答案 11 :(得分:0)
对我来说
将“部署目标”更改为11.0, 还将AppNameTEST部署目标更改为11.0
rm -rf node_modules
npm install
pod update
pod install
答案 12 :(得分:0)
在Podfile中使用platform:ios,'10 .0'而不是platform:ios,'11 .0'。
答案 13 :(得分:0)
我尝试了几个小时的其他所有方法, 有效的是在我的 Podfile 中设置:
platform :ios, '10.0'
与 iOS Deployment Target Version
中的 Info.plist
相同。他们是不同的。
答案 14 :(得分:0)
我对 iOS 构建过程有点陌生,我将分享我的解决方案,希望能避免任何人数小时的挫败感。
就我而言,这只是一个陈旧/糟糕的构建。确保您在 Xcode <YOUR_APP>.xcworkspace
中打开了正确的 Xcode 文件夹,在 Xcode 的顶部菜单中,选择 Product -> Clean Build Folder