【发布时间】:2021-06-16 19:18:58
【问题描述】:
更新 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.
For more info, see https://flutter.dev/platform-plugins
To upgrade see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.
CocoaPods not installed or not in valid state.
Error launching application on iPhone 11.
到目前为止我所做的尝试:
- 因为我使用 Flavors:method
- 宝石清单
- sudo gem 卸载 cocoapods
- sudo gem 安装 cocoapods
- pod 安装
- flutter clean + flutter pub 升级/修复 + 删除 Derived Data、Podfile.lock、Pods
- 从 vsCode 和 Xcode 重启/启动
cocoapods 版本
$ gem which cocoapods
/usr/local/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods.rb
吊舱版本
$ pod --version
1.8.4
扑医生
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.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.54.3)
[✓] Connected device (3 available)
我已经安装/卸载了好几次cocoapods,但是flutter似乎没有检测到最新版本
【问题讨论】:
-
在 Flutter 项目中的 ios 文件夹中运行“pod install”命令
-
已经发出了这个命令,正如你在我的问题中看到的那样(到目前为止我已经尝试过什么)
-
pod --version应该表示1.10.1。听起来您的路径搞砸了,并且路径中某处的pod版本混乱(可能在 $HOME/.gem/ruby//bin 中?)。使用 type -p pod,如果它没有指示预期的位置(似乎是/usr/local/bin),那么您可以考虑更新您的路径以将/usr/local/bin放在该目录之前。 -
@Petesh 当我输入 -p pod 时位置很好。但在路径 $HOME/.gem/ruby/ 我有 2 个版本的 ruby(2.3.0 和 2.6.0),在 $HOME/.gem/ruby/2.6.0/cache/ 我有 cocoapods-1.8.4 .gem 但没有 1.10.1。你怎么看?
-
非常可疑 - gem 表示 cocoapods 位于
ruby/2.7.0的子目录中,这表示用户安装的 ruby 版本(系统 ruby 即使在 big sur 上也是 2.6.0)。这里最可能的问题是pod命令正在运行操作系统提供的ruby,它是从$HOME/.gem/ruby/2.6.0/读取的。您应该检查 PATH 是否有 pod 命令的多个副本 - 这是最有可能出现的问题。如果 pod 命令启动的 ruby 版本比安装了 cocoapods-1.10.1 的版本不正确,那么任何安装和卸载都无法修复它。
标签: ios xcode flutter cocoapods