4

After updating Flutter 2, I can no longer deploy my application on 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.

What I have tried so far:

  • Because I user Flavors: method
  • gem list
  • sudo gem uninstall cocoapods
  • sudo gem install cocoapods
  • pod install
  • flutter clean + flutter pub upgrade/repair + remove Derived Data, Podfile.lock, Pods
  • Restart/Launch from vsCode & Xcode

cocoapods version

$ gem which cocoapods
/usr/local/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods.rb

pod version

$ 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.
        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)

I have installed / uninstalled cocoapods several times but flutter does not seem to detect the latest version

Lab
  • 1,237
  • 2
  • 13
  • 30
  • run "pod install" command inside ios folder, inside flutter project – Jitesh Mohite Mar 19 '21 at 11:52
  • already made this command as you can see in my question (What I have tried so far) – Lab Mar 19 '21 at 13:00
  • 1
    `pod --version` should be indicating `1.10.1`. It sounds like your path is messed up, and there's a confused version of `pod` somewhere in the path (might be in $HOME/.gem/ruby//bin?). Use `type -p pod` and if it's not indicating the expected location (which appears to be `/usr/local/bin`), then you might consider updating your path to put `/usr/local/bin` before that directory. – Anya Shenanigans Mar 19 '21 at 13:27
  • @Petesh the location is good when I do type -p pod. But in the path $HOME/.gem/ruby/ I have 2 versions of ruby (2.3.0 & 2.6.0), in $HOME/.gem/ruby/2.6.0/cache/ I have cocoapods-1.8.4.gem but no 1.10.1. What do you think ? – Lab Mar 19 '21 at 13:37
  • 2
    Very suspicous - gem indicates cocoapods in a subdirectory of `ruby/2.7.0`, which indicates a user-installed version of ruby (system ruby is 2.6.0 even on big sur). The most likely issue here is that the `pod` command is running os supplied ruby, which is reading from `$HOME/.gem/ruby/2.6.0/`. You should check your PATH for multiple copies of the pod command - this is the most likely problem. No amount of install and uninstalls will fix it if the pod command is launching the incorrect version of ruby than the one that has cocoapods-1.10.1 installed. – Anya Shenanigans Mar 19 '21 at 15:32

1 Answers1

6

I share with you what solved my problem: brew link --overwrite cocoapods

If that's not enough, here is my most revelant research Sources:

Lab
  • 1,237
  • 2
  • 13
  • 30
  • 2
    Stale pod link - was pretty much what I figured. It sounds like you have multiple copies of ruby installed on your system, and the brew recipe for cocoapods embeds all the dependencies inside it's package, and as such does not use any of the custom gems installed on your system (such as the cocoapods installed using gem install) – Anya Shenanigans Mar 19 '21 at 15:43
  • Yeah you helped me to understand ! Thank you for your time – Lab Mar 19 '21 at 15:48
  • Thank you for this. Spent hours trying to sort this out. – Loren.A Jan 07 '23 at 18:59