升级Flutter及相关包后遇CocoaPods依赖版本兼容问题
Flutter升级后CocoaPods依赖冲突及iOS平台配置问题解决
问题详情
升级Flutter到最新版本并更新所有包后,出现两个CocoaPods相关错误:
- Firebase/Firestore版本不兼容
- Runner目标未指定iOS平台版本
错误信息如下:
[!] CocoaPods could not find compatible versions for pod "Firebase/Firestore": In snapshot (Podfile.lock): Firebase/Firestore (= 8.15.0) In Podfile: cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 3.4.5, which depends on Firebase/Firestore (= 9.4.0) You have either: * changed the constraints of dependency `Firebase/Firestore` inside your development pod `cloud_firestore`. You should run `pod update Firebase/Firestore` to apply changes you've made. [!] Automatically assigning platform `iOS` with version `12.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile.
相关截图:
解决方案
1. 解决Firebase/Firestore版本冲突
- 打开终端,进入项目的iOS目录:
cd ios - 执行指定Pod的更新命令:
pod update Firebase/Firestore - 如果上述命令无效,尝试彻底清理后重新安装:
pod deintegrate rm Podfile.lock pod install
2. 明确指定iOS平台版本
- 打开项目ios目录下的
Podfile文件 - 在
target 'Runner' do代码块之前,添加平台版本指定代码(示例指定为12.0,可根据项目需求调整为更高版本):platform :ios, '12.0' - 保存文件后,回到终端执行:
pod install
内容的提问来源于stack exchange,提问作者Aravind
相关产品推荐
相关产品推荐

