[英]Flutter: CocoaPods could not find compatible versions for pod "Firebase"
I have been working on update for a Flutter app that uses Firebase Firestore
, once I finished the updated and starting to build it for IOS, I got the following error message which cause the build operation to fail:我一直在为使用
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)
Note: The error message in the question says Firebase/Auth
package but it also happened with other Firebase
packages.注意:问题中的错误消息说
Firebase/Auth
package 但它也发生在其他Firebase
包中。
So what should I do to get over this problem?那么我应该怎么做才能克服这个问题呢?
What worked for me was running pod repo update
from the XCode app directory ("ios/app" for capacitor apps) and then the pod install
command.对我有用的是从 XCode 应用程序目录(电容器应用程序的“ios/app”)运行
pod repo update
,然后运行pod install
命令。
Since you mentioned that you are using Firebase Firestore
in your app, then you case might be the same of mine.既然您提到您在应用程序中使用
Firebase Firestore
,那么您的情况可能与我的情况相同。
In the official docs of Firebase Firestore
for Flutter, you will notice an Optional step that tells you to add a line in the Podfile
to improve iOS & macOS build times by including the pre-compiled framework, like this one:在 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
The solution for me was to update the tag
number in the link in the line with the latest one from the repository on GitHub.对我来说,解决方案是使用 GitHub 上存储库中的最新版本更新行中链接中的
tag
号。 Which repo?哪个回购? the one in the line.
排队的那个。
At the dropdown that lets you select the branch
you will find a tab for selecting a tag
, just tap it and check the latest version number and use it in the line, eg The latest version for the time of this answer is 9.3.0
, so the line would be:在允许您 select
branch
的下拉列表中,您将找到一个用于选择tag
的选项卡,只需点击它并检查最新版本号并在该行中使用它,例如此答案时的最新版本是9.3.0
,所以这条线是:
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '9.3.0'
If it did not work, then you may totally ignore this optional step and remove this line from the Podfile
.如果它不起作用,那么您可以完全忽略此可选步骤并从
Podfile
中删除此行。 The build operation would take longer than before but it is better than a build failure.构建操作将比以前花费更长的时间,但比构建失败要好。
If you are using such a line in your podfile如果您在 podfile 中使用这样一行
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.3.0'
then you need to check the repo's latest version from here to keep your pub.dev firebase packages compatible:然后你需要从这里检查 repo 的最新版本以保持你的 pub.dev firebase 包兼容:
i had the same error but the correct answer didnt work for me so i deleted the Pod.lock file and applied this steps.我有同样的错误,但正确的答案对我不起作用,所以我删除了 Pod.lock 文件并应用了这些步骤。 so this The Solution worked for me:
所以这个解决方案对我有用:
Cocoa Pods Installation in M1 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
Install ffi安装 ffi
sudo arch -x86_64 gem install ffi
#update repo #更新仓库
arch -x86_64 pod install --repo-update
Flutter iOS builds Flutter iOS 构建
flutter clean
flutter build ios
my answer is based on this answer我的答案是基于这个答案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.