Xcode 12 个使用 Firebase pods。词法或预处理器问题。 "pb.h' file not found with <angled> include; use "引用“而不是”?

Xcode 12 using Firebase pods. Lexical or Preprocessor issue. "pb.h' file not found with <angled> include; use "quotes" instead"?

我刚刚下载了 Xcode 12 beta 6。我在项目中安装了 firebase,但出现此错误。当我用建议更正它时,它会告诉我用原件再次更正。对所有 'GoogleDataTransport' 重复此错误。您可以将 Firebase 与 Xcode 12 beta 6 一起使用吗?我究竟做错了什么?谢谢

更新到 CocoaPods 1.10,运行 pod deintegratepod install

要在较早的 CocoaPods 版本中解决问题,请在生成 Pods 项目构建设置中禁用 CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER 选项:

https://github.com/firebase/firebase-ios-sdk/issues/5987 and https://github.com/CocoaPods/CocoaPods/issues/9902 中有更多详细信息。

我使用 cocoapodspre-release 修复了它

sudo gem install cocoapods --pre

然后进行更新

pod install --repo-update

首先,检查命令行工具并安装。

sudo xcode-select --switch /Applications/Xcode-beta.app
sudo xcode-select --install

安装 cocoapods 预测试版

sudo gem install cocoapods --pre

切换到您的 xCode 项目。

pod deintegrate
pod install --repo-update

我的团队不想在 cocoapods 1.10 发布之前使用它,并且不想在每次 pod install 重新生成它时 re-edit Pods 项目的构建设置。这个 did the trick, credit to Léo-Paul JULIE:

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
      config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'
    end
end

编辑:正如下面 snakeoil 指出的那样,您还可以消除有关您不支持的不相关 iOS 版本的恼人警告。但是应该为每个 targetconfiguration 的构建设置编辑该设置,因此在嵌套循环中。总而言之,我现在打算做这样的事情:

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    # Can be removed when moving to cocoapods 1.10
    config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'
  end
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # Inherit the deployment target defined in this Podfile instead, e.g. platform :ios, '11.0' at the top of this file
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

就我而言,Performance Monitoring Pod 导致了这个问题。当我尝试安装性能监控时。

pod 'Firebase/Performance'

不知何故与 Firebase Core Pod 发生了冲突。解决它。

  • 在 Podfile
  • 中注释掉所有 Firebase Pods
  • 运行 Pod 安装
  • 在 Podfile 中取消注释 Firebase 性能监视器
  • 运行 Pod 安装
  • 在 Podfile
  • 中取消注释所有其他 Firebase Pods
  • 运行 Pod 安装

这个问题可能是在 M1 (Apple Silicon) 机器上开发 iOS 的结果。在这种情况下,解决问题的唯一方法是下载一个名为“ffi”的 Ruby 扩展,您可以在此处阅读(以获取更多信息):https://rubygems.org/gems/ffi/versions/1.0.9

为此:

在终端中,使用以下命令将 ffi 安装到您的计算机上:

sudo arch -x86_64 gem 安装 ffi

然后在您的项目文件中,使用以下命令安装您的 podfile:

arch -x86_64 pod 安装

这应该允许您安装 pods(尤其是当您遇到“zsh: abort pod install”问题时。注意终端会警告您“Ruby 解释器或扩展库”。

在此之后,如果您的广告连播是 FireStore/FireBase,您可能需要在您的项目中获取另一个 GoogleService-Info.plist 文件。