177

I've update my flutter package to the last versions and now IOS doesn't work anymore.

When I try to update the pods it shows this error:

    [!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
    In Podfile:
    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 0.0.1, which depends on
    Firebase/Firestore (~> 6.0) was resolved to 6.0.0, which depends on
    Firebase/CoreOnly (= 6.0.0)

    cloud_functions (from `.symlinks/plugins/cloud_functions/ios`) was resolved to 0.0.1, which depends on
    Firebase/Functions (~> 5.18) was resolved to 5.18.0, which depends on
    Firebase/CoreOnly (= 5.18.0)

Here my pubspec.yaml (Firebase related):

firebase_core: "^0.4.0"
firebase_auth: "^0.11.0"
firebase_analytics: "^3.0.0"  
cloud_firestore: "^0.11.0+1"
cloud_functions: "^0.3.0"
firebase_storage: "^3.0.0"
firebase_messaging: "^5.0.1"

I've made various steps to try to fix:

flutter clean
flutter build ios

pod install
pod update
pod repo update
pod install --repo-update

I've set platform :ios, '12.1' in Podfile and in Xcode as build target but nothing come back to works.

Here my podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '12.1'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  use_frameworks!

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end
danronmoon
  • 3,814
  • 5
  • 34
  • 56
Luca Panteghini
  • 2,657
  • 3
  • 21
  • 27
  • I don't know the flutter yaml, but the `0.11.0+1` looks suspicious since FirebaseFirestore is asking for Firebase 6.x and FirebaseFunctions is asking for Firebase 5.x – Paul Beusterien May 10 '19 at 00:05
  • I put my answer under another question in case the accepted answer didn't halp. https://stackoverflow.com/a/69047809/513413 – Hesam Sep 03 '21 at 16:11

32 Answers32

350

Try calling pod repo update

if the issue is not fixed

delete the Podfile.lock in the root directory, after that run pod install

Mohhamed Nabil
  • 4,104
  • 1
  • 15
  • 11
165

Edit the minimum ios version in the podfile then run pod install.

Changing platform :ios, '9.0' to platform :ios, '10.0' then running pod install fixed it for me.

Abdelrahman Sherif
  • 2,080
  • 1
  • 9
  • 12
  • 2
    Worked perfect, when I have changed it in Xcode under "Runner" -> "Runner" -> "Info" -> "iOS Deployment Target" to version >= 10.0.0 – Julian Schmuckli Mar 13 '21 at 23:03
  • This worked out for me as well. Removed `Podfile.lock`, then ran `pod repo update` and `pod install`. – sunderee Jul 15 '22 at 09:46
107

For M1 Mac Users

  1. Go to ios/Pods/Local Podspecs directory in your project
  2. Check every json file to find highest required iOS version. Mine was "ios": "10.0" in some of them
  3. Go back to ios/ directory
  4. Open Podfile file
  5. Uncomment # platform :ios, '9.0' and replace 9.0 with version from step 2. - for example 10.0.

then here comes the M1 specific part

  1. Run sudo arch -x86_64 gem install ffi

  2. Run arch -x86_64 pod repo update

  3. Run arch -x86_64 pod install error should be gone

  4. If using Flutter cd - back to your root directory - open iOS Simulator & run flutter run

If not working you might need to run flutter pub add firebase_coreto add firebase_core to your pubspec.yaml file Before Step 1


If still not working try this BONUS STEPS :

  • Trying to Run directly from Xcode ? First Run flutter build iOS in your Flutter project -> then Run in Xcode

  • Still not working cd iOS run rm -rf Pods/ Podfile.lock ; pod install

  • Still not working ? Search Keychain Access in Spotlight -> open -> Right-click on login -> Unlock (you will lock back when build succeeds)

  • Still not working ? Xcode Runner Info Screenshot make sure your Runner Info Configs look like this

Dharman
  • 30,962
  • 25
  • 85
  • 135
Aristidios
  • 1,921
  • 2
  • 13
  • 24
36

Just do a pod update and then pod install. This worked for me.

Vishal Kumar
  • 469
  • 5
  • 3
27
  1. Execute flutter clean

  2. Go to ios/ folder, edit Podfile and choose the platorm and version you want to launch. For example for platform ios and version 12.0 :

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
  1. Execute pod update

  2. Execute pod install (it can take a some minutes to download dependencies)

  3. Execute flutter run

Adrien Arcuri
  • 1,962
  • 1
  • 16
  • 30
26

If you are using an M1 mac.

Delete podfile.lock by running

arch -x86_64 rm -rf Podfile.lock

and then update pods by running

arch -x86_64 pod install --repo-update
Mahesh Jamdade
  • 17,235
  • 8
  • 110
  • 131
15

For M1 Mac,

It is easiest and fastest to find the answer in the last part.

move to folder ios:

cd ios

Method 1:

Open your terminal and run

sudo gem uninstall cocoapods
sudo gem install cocoapods

restart IDE or Editor

Method 2:

Note: Try only if Method 1 will not work

Now time to install pod for M1 Mac:

 sudo arch -x86_64 gem install ffi
 arch -x86_64 pod repo update
 arch -x86_64 pod install

Now 99% chance installation error should be gone

Now only for the 1% chance that you are still getting errors:

open your ios Runner XCode project and follow the image instructions.

Change your Excludeed Architectures from Architectures for Target

form i386 to arm64 i386 (Note: space is important)

enter image description here

Now come back to your root directory and run

 flutter run

Also, Restart your editor.

Advance Note:

Getting this error multiple times and copy-pasting each time fixes it. Therefore, I am here to offer a better way to accomplish this with the help of method 2:

Copy below the Written code

#!/bin/bash

pwd
sudo arch -x86_64 gem install ffi
arch -x86_64 pod repo update
arch -x86_64 pod install

You will need to create a script file in your IOS Folder, let's call it pod_install.sh Should you ever encounter the same problem again, you will only need to run one command.

sh pod_install.sh 

from your ios folder

now enter the password of your mac

now tea ☕ time

Don't forget to Restart your editor.

Anup Gupta
  • 1,993
  • 2
  • 25
  • 40
  • 1
    `arch -x86_64 pod repo update` this command works for me... after that, i am able to install pod on M1 by `arch -x86_64 pod install` this command... – Wahab Khan Jadon Jul 25 '22 at 16:13
  • On M2 Mac this command `sudo arch -x86_64 gem install ffi` gives me error "arch: posix_spawnp: gem: Bad CPU type in executable". – markhorrocks May 20 '23 at 09:03
14

enter image description here

To use the "firebase_core" dependency with version ^1.0.3, the "iOS Deployment Target" has to be not less than "10.0"

neronovs
  • 247
  • 3
  • 6
  • HERO, took two days to figure out the M1 settings, although they were working on M1 but for some reason it stoped. And pod install or update never worked again until those methods. Thanks again. – Huthaifa Muayyad Jan 01 '22 at 16:34
8

I just ran into this same issue when trying to add Firebase Analytics to my projct. I kept running pod update in the terminal, but I couldn't successfully get to FirebaseCore (6.0.0) until I made sure that all flutter packages in the pubspec.yaml file were on the latest version.

1) I got rid of the package that was causing the error. For me, it was Firebase Analytics because I had just added that to my project.

2) I went through all of the firebase packages and made sure I had the most recent version in my pubspec.yaml. Here they are:

firebase_core: ^0.4.0
firebase_database: ^3.0.0
firebase_auth: ^0.11.0
firebase_storage: ^3.0.0

3) Navigate to ios folder and run pod update

4) Add Firebase Analytics package (or whatever you are interested in adding) to pubspec.yaml.

5) Run packages get

6) Run pod install in terminal

Eric Duffett
  • 1,654
  • 17
  • 25
8

March 2021

cloud_firestore: ^1.0.0

cd ios
rm Podfile.lock
pod repo update
awaik
  • 10,143
  • 2
  • 44
  • 50
7

The simple solution worked for me (Suggested by the IDE itself)

pod install --repo-update

Run the command in terminal IOs folder

Afinas EM
  • 2,755
  • 1
  • 15
  • 28
5

In React Native

cd ios

rm -rf Podfile.lock

pod install
Aayush Bhattacharya
  • 1,628
  • 18
  • 17
4

pod update then pod install. This worked for my side

delavega66
  • 855
  • 2
  • 23
  • 39
Sherif Samir
  • 259
  • 3
  • 5
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 01 '22 at 09:58
4

For me this worked

# Uncomment this line to define a global platform for your project
 platform :ios, '12.0'
Quick learner
  • 10,632
  • 4
  • 45
  • 55
4

=== 2023, April UPDATE ===

As of 2023, April, you have to do this:

Edit iod/Podfile and edit/modify or uncomment this line :

platform :ios, '11.0'

Save the file and execute this command in ios directory:

rm -rf Podfile.lock && pod install --repo-update
Alaindeseine
  • 3,260
  • 1
  • 11
  • 21
3

Worked for me when i added the highest ios version dependency from the symlinks/plugins in the Podfile platform :ios, '11.0'

Dharman
  • 30,962
  • 25
  • 85
  • 135
Abel Tilahun
  • 1,705
  • 1
  • 16
  • 25
3

As of 28 April 2021, what worked for me (after days of struggle):

In AppDelegate.swift (flutter-project/ios/Runner), add these 2 lines:

FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)

In Terminal:

pod repo update 

flutter build ios

Then run your project in Xcode.

shim
  • 9,289
  • 12
  • 69
  • 108
MeepMeep
  • 61
  • 1
3

Go back to the ios folder and open the Podfile then change platform as below platform :ios, '10.0'. After that click the run button from your Editor.

Fakhriddin Abdullaev
  • 4,169
  • 2
  • 35
  • 37
3

At first delete podfile.lock file from your ios folder

then goto your ios folder from terminal

cd ios

now type in terminal

pod repo update
pod install

or

pod install
pod repo update
Rasel Khan
  • 2,976
  • 19
  • 25
1

This migration guide for react-native-firebase could be useful for your case:

https://rnfirebase.io/migrating-to-v6#removing-v5-from-javascript

I uninstalled version 5 and installed version 6, but it seems there was some extra work to do to get rid of older versions of firebase.

alebagran
  • 675
  • 5
  • 5
1
  1. Delete Podfile
  2. pod init
  3. pod install

Worked for me

1

Here's what worked for me.

  1. delete the Podfile.lock in the ios directory
  2. after run arch -x86_64 pod install
ADev
  • 71
  • 1
  • 4
1

This issue has been so annoying. But this is how I solved it. 1- First of all, I updated the firebase packages.

   firebase_core: 1.10.0
   firebase_auth: 3.4.1

2- I went into the Android studio terminal and wrote it.

cd ios
pod deintegrate
pod repo update

3- in the ios folder I deleted the .symlinks folder

4- Finally,I also wrote in Terminal

pod install

If it still fails, change the firebase updates from step 1 and repeat the other steps.

smebes
  • 241
  • 3
  • 2
1

My podfile had this line commented platform :ios, '11.0' and set to 11 i uncommented and changed to 14

1

If after doing the:

Try calling pod repo update

if the issue is not fixed

delete the Podfile.lock in the root directory, after that run pod install

That @mohhamed mentioned, it's still not working, please do the following since this has to do directly with the versions that your packages have on the pods.xcodeproj file a quick way you can set this up is the following:

run flutter clean then run flutter pub get.

once you do that open you xcode project, doesn't matter if it was opened before, right clic on IOS and clic on the open in xcode.

while it's indexing go back to your console and do flutter run.

when you get to have the error again. head into xcode and look for this issue under the issues tab.

issues tab on xcode with validate project settings

as you can see we are being recommended by xcode to update to the recommended setting on our Pods.xcodeproj file. once we clic on it, we will see the following screen.

Build recommended settings

at last clic in perform changes and it will updated the dependencies of the file.

after this you are all set, you can do flutter run and continue to do the coding.

now please have in mind that if you run flutter clean again, you will incur into this error again and will have to re do the previous steps.

0

I had to follow this answer and do 2 things

1- In my Podfile I had platform :ios, '13.0', I had to switch it to platform :ios, '10.0'

2- I had to remove my entire podfile and reinstall it but this time for the Firebase/Database pod I used pod 'Firebase/Database', '~> 7.0.0'

My podfile looks like this now:

platform :ios, '10.0'
install! 'cocoapods', :deterministic_uuids => false

target 'MyApp' do
use_frameworks!

# Pods for MyApp

pod 'Firebase/Database', '~> 7.0.0'

// other pods ...
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
0

I fixed that issue.

  1. I guess you add new firebase package and then issue appear.
  2. remove last added packages
  3. run flutter clean
  4. delete podfile.lock
  5. Ensure all firebase packages use updated version
  6. run flutter pub get
  7. go cd ios/
  8. run pod install Then fixed.
Eray Hamurlu
  • 657
  • 7
  • 9
0

Go back to pubspec.yaml and make sure the flutter fire packages are all compatible together. My issue was because firebase_remote_config version was slightly newer than the cloud firestore and consecutively caused the error when I ran Pod update.

Jay Shenawy
  • 953
  • 1
  • 12
  • 22
0

Simple solution that worked for me, this was being caused because I was using an older version of a Firebase dependency. So upgrading all dependencies and then using flutter pub get and flutter run worked for me

-1

The problem is in cloud_functions plugins. They have 5.18 version of Firebase. For fix it you must change manually the file cloud_functions.podspec in the ios folder of the plugin while their doesn't finally fix.

Change it

s.dependency 'Firebase/Firestore', '~> 5.18'

to

s.dependency 'Firebase/Firestore', '~> 6.0'

After that still remaing an error regarding some missed dependencies of Firebase functions files.

I add directly in the pod this line:

pod 'Firebase/Functions'

I know that all this is an workaround but works in this way for me.

Luca Panteghini
  • 2,657
  • 3
  • 21
  • 27
-1

The error clearly said that you have a compatibility issue in your cocopod file which may caused when you update the flutter dependencies.You can resolve the issue by reconfiguring the pod files: run these commands.

flutter clean

flutter pub get

flutter upgrade

cd ios

pod cache clean --all

Pod clean

pod deintegrate

sudo gem install cocoapods-deintegrate cocoapods-clean

sudo arch -x86_64 gem install ffi

arch -x86_64 pod repo update

arch -x86_64 pod install

Mashood .H
  • 926
  • 6
  • 16
-1

Check if you have a similar line in ios/Podfile:

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'

If you do, try commenting it out with a # at the beginning of the line, or removing it.

When adding Firestore, I followed the advice from the instructions and added this line in order to use a pre-compiled framework and decrease build time on iOS. Removing this line immediately solved this issue for me and pod install completed successfully.

Magnus
  • 17,157
  • 19
  • 104
  • 189