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

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

Xcode error: library not found for -lGoogleToolboxForMac

iosobjective-cxcodeadmobgoogle-toolbox-for-mac

提问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

未找到框架 GoogleToolboxForMac ld:未找到用于 -lGoogleToolboxForMac 的库

回答by Charlie Seligman

Finally worked out a fix:

终于找到了解决办法:

  1. Xcode > Product > Scheme > Manage Schemes
  2. Select to 'Show' the scheme that was failing (GoogleToolboxForMac)
  3. Select this scheme in the dropdown, just to the right of the 'Stop' button
  4. Build this scheme
  5. Then select the original scheme (in the dropdown mentioned in step 3) and rebuild
  1. Xcode > 产品 > 方案 > 管理方案
  2. 选择“显示”失败的方案 (GoogleToolboxForMac)
  3. 在“停止”按钮右侧的下拉列表中选择此方案
  4. 建立这个方案
  5. 然后选择原始方案(在步骤 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 Debugbase configuration in the xcodeprojwhen 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:

我通过以下方式解决了这个问题:

  1. Adding the Debugbase configuration
  2. Setting the Debugconfiguration value to None
  3. Running pod install
  1. 添加Debug基本配置
  2. Debug配置值设置为None
  3. 跑步 pod install

This is how the base configuration should look like after step 3: Xcodeproj Configuration]1

这是基本配置在第 3 步之后的样子: Xcodeproj 配置] 1