I have a Flutter app that runs fine on Android devices. It has a Firebase Firestore backend.
Now, I want to build it on an iOS simulator, and so I need to initialize the Firebase iOS app. (I had only initialized the Android version before.) So I tried following the steps on firebase.com for setting up the iOS Firebase app using Cocoapods… but I think I did something wrong! More specifically, I believe the steps I followed were for adding Firebase to a native iOS app (in Objective C or similar), but when using Flutter, I’m supposed to let the Flutter framework do most of this work, rather than adding pods manually! (Here’s a specific instruction for adding Firebase to a Flutter iOS project)
But before doing it right, I want to remove the pods that Cocoapods installed for me. Only I don’t know how! 😣 When I web-search, I’m told to delete the pods I don’t want from the Podfile
. Only there ARE no pods in my ios/Podfile
! There’s only a bit that says:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
There’s also an ios/Podfile.lock
file, and THAT one has a list of all the pods… And then, there’s an ios/Pods/Manifest.lock
file, which also has such a list… So should I delete the unwanted pod names from one of these two files, instead?
Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile
?
2
Answers
Turns out the correct way to install and remove pods from a Flutter project is just to edit the
pubspec.yaml
file in the root directory!Cocoapods needs to be installed, but it will automatically read the
pubspec.yaml
file and do the work from there! 🙂 No need to runpod
commands from terminal or otherwise.I suppose you followed these steps? in this case, you don’t need to remove pods.
For step 1, step 2, it should be fine.
For step 3, just remove the config file.
For step 4, if you added firebase with swift package manager, remove it from your packages.
How did you add pods manually? from your Podfile, I didn’t see any new added pods.
You don’t need to do anything, in worst cases, just remove the
Podfile
and re-run the app to let flutter regenerate it.