繁体   English   中英

Flutter:CocoaPods 找不到 pod“Firebase”的兼容版本

[英]Flutter: CocoaPods could not find compatible versions for pod "Firebase"

我一直在为使用Firebase Firestore的 Flutter 应用程序更新,完成更新并开始为 IOS 构建它后,我收到以下错误消息,导致构建操作失败:

[!] CocoaPods could not find compatible versions for pod "Firebase/Auth":
    In snapshot (Podfile.lock): 
       Firebase/Auth (= 9.3.0)

    In Podfile:
       firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) was resolved to 3.3.12, which depends on Firebase/Auth (= 8.14.0)

注意:问题中的错误消息说Firebase/Auth package 但它也发生在其他Firebase包中。

那么我应该怎么做才能克服这个问题呢?

对我有用的是从 XCode 应用程序目录(电容器应用程序的“ios/app”)运行pod repo update ,然后运行pod install命令。

既然您提到您在应用程序中使用Firebase Firestore ,那么您的情况可能与我的情况相同。

在 Flutter 的Firebase Firestore官方文档中,您会注意到一个可选步骤,告诉您在Podfile中添加一行以改进 iOS 和 macOS 构建时间,包括预编译时间:

target 'Runner' do
  ...
  # This is the mentioned line
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'
  ...
end

对我来说,解决方案是使用 GitHub 上存储库中的最新版本更新行中链接中的tag号。 哪个回购? 排队的那个。

在允许您 select branch的下拉列表中,您将找到一个用于选择tag的选项卡,只需点击它并检查最新版本号并在该行中使用它,例如此答案时的最新版本是9.3.0 ,所以这条线是:

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '9.3.0'

如果它不起作用,那么您可以完全忽略此可选步骤并从Podfile中删除此行。 构建操作将比以前花费更长的时间,但比构建失败要好。

如果您在 podfile 中使用这样一行

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.3.0'

然后你需要从这里检查 repo 的最新版本以保持你的 pub.dev firebase 包兼容:

预编译框架版本

我有同样的错误,但正确的答案对我不起作用,所以我删除了 Pod.lock 文件并应用了这些步骤。 所以这个解决方案对我有用:

Cocoa M1 中的 Pod 安装

sudo gem install cocoapods
sudo gem install ffi
arch -x86_64 sudo gem install cocoapods -n /usr/local/bin
sudo gem install cocoapods -n /usr/local/bin

安装 ffi

sudo arch -x86_64 gem install ffi

#更新仓库

arch -x86_64 pod install --repo-update

Flutter iOS 构建

flutter clean
flutter build ios

我的答案是基于这个答案

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM