在 ios flutter app 文件夹上运行时无法执行命令“pod install”。
错误如下:
分析依赖关系 firebase_core:使用“firebase_core”中定义的 Firebase SDK 版本“10.0.6” firebase_messaging:使用“firebase_core”中定义的 Firebase SDK 版本“10.0.6”
[!] CocoaPods 找不到 pod“Firebase/Messaging”的兼容版本: 在 Podfile 中: firebase_messaging(来自
.symlinks/plugins/firebase_messaging/ios
)已解析为 10.0.6,这取决于
Firebase/消息传递 (= 10.0.6)
您的规范源都不包含满足依赖关系的规范:
Firebase/Messaging (= 10.0.6)
。
您有:
pod repo update
或 pod install --repo-update
进行更新。我们在 pubspec.yaml 上有这个包
firebase_core: ^1.6.0
firebase_messaging: ^10.0.6
在 podfile 上:
platform :ios, '10.0'
我们使用pod版本:
1.11.0.rc.1
macOS Big Sur 版本:
11.2.1
如果我们从 pubspec.yaml 中删除这个包,pod install 就可以正常工作。
我们尝试了很多方法都没有效果!
当你在 IOS 上添加新的依赖项时,你应该这样做:
cd ios/
rm -rf Pods/
rm -rf Podfile.lock
cd ..
flutter clean
flutter pub get
cd ios
pod install
pod install --repo-update ( if needed)
这总是帮助我解决 IOS 上的依赖问题
使用此命令解决了问题
flutter pub cache repair
谢谢大家!
如果有人在这里展示,我通过在 iOS 目录中运行 pod update 命令修复了此问题。
我也遇到了同样的问题,通过Run解决了。
flutter pub cache repair
pod install --repo-update