Xcode error: library not found for -lGoogleToolboxForMac

Xcode error: library not found for -lGoogleToolboxForMac

我正在尝试在我的 iPhone 应用程序(用 objective-c 编写)中安装 admobs。我已经使用 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)

我肯定会打开 .xcworkspace 文件(而不是 .xcodeproj 文件)。

我还尝试删除 'DerivedData' 文件夹内容和 'Cleaning' 项目并执行 'Clean Build Folder'。 None 已解决问题。

我的 podfile 只包含以下 pods:

# 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'

我尝试将底部的 3 个逐个添加,但一直出现相同的构建错误。

有人可以帮忙吗?对此完全不知所措。看到这两个问题,但他们接受的解决方案并没有解决这个问题:

终于解决了:

  1. Xcode > 产品 > 方案 > 管理方案
  2. Select 到 'Show' 失败的方案 (GoogleToolboxForMac)
  3. Select 这个方案在下拉列表中,就在 'Stop' 按钮的右边
  4. 构建此方案
  5. 然后select原始方案(在第3步提到的下拉列表中)并重建

全部正确构建。

看来我必须手动构建单独的方案。

注意:要自动构建这些,请使用 Product > Scheme > 'Edit Scheme' > Build > 并确保添加所有目标,并在底部添加项目目标。

我在构建 Simulator 时在 Xcode 10 中遇到了这个错误。这是因为我在尝试解决 Cocoapods 警告时删除了 xcodeproj 中的 Debug 基本配置: "CocoaPods did not set the base configuration of your project because your project already has a custom config set."

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

  1. 添加 Debug 基本配置
  2. Debug 配置值设置为 None
  3. 运行 pod install

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