Is there a way to solve the problem I am facing after upgrading firebase in flutter

Viewed 308

Hi I am facing an error on flutter while running my application in iOS simulator only. It works perfectly fine in Android simulator. After I upgraded my firebase dependencies that I added since then I am facing the issue. The version I was using before are as follow

firebase_auth: ^0.18.3
cloud_firestore: ^0.14.3
firebase_core: ^0.5.2
firebase_crashlytics: ^0.2.4

The version I am using now are as follow

firebase_auth: ^0.20.0
cloud_firestore: ^0.16.0
firebase_core: ^0.7.0
firebase_crashlytics: ^0.4.0

The error I am getting is

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please
    specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Error launching application on iPhone 12.

Note this issue is only in iOS and not on Android and I wanted to upgrade the firebase. I have tried many methods on Stackoverflow and other resources but it seems to be of no help.

3 Answers

Delete the 2 pod files in the ios folder. run Flutter clean command in the terminal and then try running the app on your iPhone. This happens to me often and the above method works for me.

This problem occurs because you have not set a minimum ios version in your Podfile.
Set a platform version in your Podfile.
cd ios
nano Podfile
Uncomment this line at the start of the file
# platform :ios, '9.0'
You can set the version to 11.0 if you like as some plugins don't support 9.0 anymore.
After that is done, run the following commands:

rm Podfile.lock
rm -rf Pods
pod install

Additionally, you can update the minimum iOS version for your app in the Runner to the version you set in the Podfile
That should do it for you.

I Have tried multiple stuff and failed on doing this and now I got the perfect solution for MacBook M1 Chip users. We need to clear all the cache files and update the pods

following the below steps would be the best

  1. Remove the .Pods and .symlinks in the iOS folder inside the flutter project.

  2. Remove Podfile.lock Remove pubspec.lock

  3. Run Flutter clean

  4. Run Flutter pub get

  5. Change into iOS folder and run

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

PS: For M1 Users

Related