You need to enable JavaScript to run this app. 升级Flutter 2后iOS部署报CocoaPods版本错误、无法启动应用怎么办?
优惠活动
大模型
产品
解决方案
定价
更多

升级Flutter 2后iOS部署报CocoaPods版本错误、无法启动应用怎么办?

升级Flutter 2后iOS平台部署异常

升级到Flutter 2后,iOS平台无法正常部署应用,启动时报错信息如下:

Warning: CocoaPods minimum required version 1.9.0 or greater not installed.
Skipping pod install.
  CocoaPods is used to retrieve the iOS and macOS platform side's plugin code
  that responds to your plugin usage on the Dart side.
  Without CocoaPods, plugins will not work on iOS or macOS.
  相关功能说明可查看官方平台插件文档获取更多信息
升级操作可参考CocoaPods 官方安装指引完成。

CocoaPods not installed or not in valid state.
Error launching application on iPhone 11.

目前已尝试的解决操作

  • 因项目使用Flavors多环境配置,参考社区同类问题的适配方法
  • 执行gem list命令排查已安装的本地包
  • 执行sudo gem uninstall cocoapods卸载现有CocoaPods
  • 执行sudo gem install cocoapods重装CocoaPods
  • 在iOS项目目录下执行pod install
  • 执行flutter clean + flutter pub upgrade/flutter pub repair,同时删除Xcode Derived Data目录、项目内的Podfile.lock、Pods目录
  • 分别从VS Code与Xcode重启项目尝试启动

CocoaPods版本核查结果

本地存在明显的版本路径不匹配问题:

  • 通过gem which cocoapods查询到的gem渠道安装的CocoaPods包路径与版本:
$ gem which cocoapods
/usr/local/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods.rb
  • 通过pod --version查询到的终端实际可调用的CocoaPods版本:
$ pod --version
1.8.4

Flutter Doctor 检测结果

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.2, on macOS 11.2.3 20D91 darwin-x64, locale en-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[!] Xcode - develop for iOS and macOS
    ! CocoaPods 1.8.4 out of date (1.10.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
      相关功能说明可查看官方平台插件文档获取更多信息
      升级操作可参考CocoaPods 官方安装指引完成
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.54.3)
[✓] Connected device (3 available)

多次执行CocoaPods的卸载、重装操作后,Flutter始终无法检测到最新安装的CocoaPods版本。


内容的提问来源于stack exchange,提问作者Lab

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.29 08:54:03