Flutter 2 升级:CocoaPods 未安装或未处于有效状态

Lab*_*Lab 4 xcode ios cocoapods flutter

更新 Flutter 2 后,我无法再在 IOS 上部署应用程序:

\n
Warning: CocoaPods minimum required version 1.9.0 or greater not installed.\nSkipping pod install.\n  CocoaPods is used to retrieve the iOS and macOS platform side\'s plugin code\n  that responds to your plugin usage on the Dart side.\n  Without CocoaPods, plugins will not work on iOS or macOS.\n  For more info, see https://flutter.dev/platform-plugins\nTo upgrade see\nhttps://guides.cocoapods.org/using/getting-started.html#installation for\ninstructions.\n\nCocoaPods not installed or not in valid state.\nError launching application on iPhone 11.\n
Run Code Online (Sandbox Code Playgroud)\n

到目前为止我已经尝试过:

\n
    \n
  • 因为我使用 Flavors:方法
  • \n
  • 宝石清单
  • \n
  • sudo gem 卸载 cocoapods
  • \n
  • sudo gem 安装 cocoapods
  • \n
  • 吊舱安装
  • \n
  • flutter clean + flutter pub 升级/修复 + 删除派生数据、Podfile.lock、Pod
  • \n
  • 从 vsCode 和 Xcode 重新启动/启动
  • \n
\n

可可豆版本

\n
$ gem which cocoapods\n/usr/local/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods.rb\n
Run Code Online (Sandbox Code Playgroud)\n

吊舱版本

\n
$ pod --version                                                                                                                                                      \n1.8.4\n
Run Code Online (Sandbox Code Playgroud)\n

扑医生

\n
Doctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] Flutter (Channel stable, 2.0.2, on macOS 11.2.3 20D91 darwin-x64, locale en-FR)\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 29.0.2)\n[!] Xcode - develop for iOS and macOS\n    ! CocoaPods 1.8.4 out of date (1.10.0 is recommended).\n        CocoaPods is used to retrieve the iOS and macOS platform side\'s plugin code that responds to your plugin usage on the Dart side.\n        Without CocoaPods, plugins will not work on iOS or macOS.\n        For more info, see https://flutter.dev/platform-plugins\n      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.\n[\xe2\x9c\x93] Chrome - develop for the web\n[\xe2\x9c\x93] Android Studio (version 3.5)\n[\xe2\x9c\x93] VS Code (version 1.54.3)\n[\xe2\x9c\x93] Connected device (3 available)\n
Run Code Online (Sandbox Code Playgroud)\n

我已经安装/卸载了几次 cocoapods 但 flutter 似乎没有检测到最新版本

\n

Lab*_*Lab 6

我与您分享解决我问题的方法: brew link --overwrite cocoapods

如果这还不够,这里是我最相关的研究来源:

  • 陈旧的 Pod 链接 - 和我想的差不多。听起来您的系统上安装了多个 ruby​​ 副本,并且 cocoapods 的 brew 配方将所有依赖项嵌入到其包中,因此不使用系统上安装的任何自定义 gem(例如使用安装的 cocoapods)宝石安装) (2认同)