Xcode 错误:找不到 -lGoogleToolboxForMac 的库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40962936/
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
Xcode error: library not found for -lGoogleToolboxForMac
提问by Charlie Seligman
I am trying to install admobs in my iPhone App (written in objective-c). I have implemented this many times using swift projects, but currently I keep getting the following build error:
我正在尝试在我的 iPhone 应用程序中安装 admob(用objective-c 编写)。我已经使用 swift 项目多次实现了这一点,但目前我不断收到以下构建错误:
ld: warning: directory not found for option '-L/Users/charlieseligman/Library/Developer/Xcode/DerivedData/ThamesClippers-csissodainpbbjenykdyxuutzxtg/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: warning: directory not found for option '-L/Users/charlieseligman/Documents/GIT/iOS.ThamesClippers/build/Debug-iphoneos/GoogleToolboxForMac'
ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am definitely opening the .xcworkspace file (and not the .xcodeproj file).
我肯定是打开 .xcworkspace 文件(而不是 .xcodeproj 文件)。
I have also tried deleting 'DerivedData' folder contents & 'Cleaning' the project and doing a 'Clean Build Folder'. None has resolved the issue.
我还尝试删除“DerivedData”文件夹内容和“清理”项目并执行“清理构建文件夹”。没有人解决了这个问题。
My podfile only includes the following pods:
我的 podfile 仅包含以下 pod:
# Pods for ThamesClippers
pod 'Google/Analytics'
pod 'Firebase/Core'
pod 'Firebase/AdMob'
# Trying to fix GoogleToolboxForMac missing error
pod 'Firebase/Messaging'
pod 'GoogleToolboxForMac/Logger'
pod 'GoogleToolboxForMac', '~> 2.1'
I have tried adding the bottom 3 one-by-one but kept getting the same build error.
我试过一一添加底部 3 个,但一直收到相同的构建错误。
Can anyone help? At a complete loss on this one. Seen these two questions but their accepted solutions have not resolved this issue:
任何人都可以帮忙吗?完全失去了这一点。看到这两个问题,但他们接受的解决方案并没有解决这个问题:
Framework not found GoogleToolboxForMacld: library not found for -lGoogleToolboxForMac
回答by Charlie Seligman
Finally worked out a fix:
终于找到了解决办法:
- Xcode > Product > Scheme > Manage Schemes
- Select to 'Show' the scheme that was failing (GoogleToolboxForMac)
- Select this scheme in the dropdown, just to the right of the 'Stop' button
- Build this scheme
- Then select the original scheme (in the dropdown mentioned in step 3) and rebuild
- Xcode > 产品 > 方案 > 管理方案
- 选择“显示”失败的方案 (GoogleToolboxForMac)
- 在“停止”按钮右侧的下拉列表中选择此方案
- 建立这个方案
- 然后选择原始方案(在步骤 3 中提到的下拉列表中)并重建
All built correctly.
全部正确构建。
So it looked like I had to build the separate scheme manually.
所以看起来我必须手动构建单独的方案。
Note: To build these automatically, use Product > Scheme > 'Edit Scheme' > Build > And make sure all targets are added with your project target at the bottom.
注意:要自动构建这些,请使用 Product > Scheme > 'Edit Scheme' > Build > 并确保所有目标都与您的项目目标一起添加到底部。
回答by owjhart
I got this error in Xcode 10 when building to the Simulator
. This is because I deleted the Debug
base configuration in the xcodeproj
when attempting to resolve the Cocoapods warning:
"CocoaPods did not set the base configuration of your project because your project already has a custom config set."
我在 Xcode 10 中构建到Simulator
. 这是因为我在尝试解决 Cocoapods 警告时删除了Debug
基本配置xcodeproj
:
"CocoaPods did not set the base configuration of your project because your project already has a custom config set."
I resolved the issue by:
我通过以下方式解决了这个问题:
- Adding the
Debug
base configuration - Setting the
Debug
configuration value toNone
- Running
pod install
- 添加
Debug
基本配置 - 将
Debug
配置值设置为None
- 跑步
pod install
This is how the base configuration should look like after step 3:
]1
这是基本配置在第 3 步之后的样子:
] 1