0

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?

Karolina Hagegård
  • 1,180
  • 5
  • 26
  • Does this answer your question? [How to clear or clean specific pod from the local cocoapods cache](https://stackoverflow.com/questions/46428752/how-to-clear-or-clean-specific-pod-from-the-local-cocoapods-cache) – Peter Koltai Aug 14 '22 at 11:58
  • Doesn't seem that way! I want to remove them from the project, not just from the cache. Removing them from cache means they'll be downloaded anew when you rebuild the project, and that's not what I want. – Karolina Hagegård Aug 14 '22 at 12:34
  • And if you execute the steps and stop after `pod deintegrate`? Does it not complete remove it? – Peter Koltai Aug 14 '22 at 13:04
  • Have you tried this? Or I'm your guinea pig? Surely, the whole purpose with clearing cache is so that you can reload something afresh... NOT to remove it from the project! A cache is kind of like an "optional extra"! Not something you "need" for your project to work... And if you're suggesting that I NEVER run `pod install` again, that hardly sounds like a sustainable solution either... Don't you think? I'm looking for the CORRECT way to uninstall pods, not a way to try and trick the system... – Karolina Hagegård Aug 15 '22 at 13:58
  • No, I used the instructions in the linked answer many times when I ran into trouble with Flutter iOS builds. After that when you build for iOS all the pods that are needed will be downloaded. Maybe I misunderstood what you want. Anyway, good luck with finding the solution that you need! – Peter Koltai Aug 15 '22 at 15:01
  • Yes, you misunderstood me then. As I said, I did NOT want the pods to be downloaded again, as I wanted them gone. Uninstalled. No longer part of the project. :) – Karolina Hagegård Aug 15 '22 at 17:54

2 Answers2

1

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 run pod commands from terminal or otherwise.

Karolina Hagegård
  • 1,180
  • 5
  • 26
0

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.

I'm supposed to let the Flutter framework do most of this work, rather than adding pods manually!

How did you add pods manually? from your Podfile, I didn't see any new added pods.

Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile?

You don't need to do anything, in worst cases, just remove the Podfile and re-run the app to let flutter regenerate it.

JIE WANG
  • 1,875
  • 1
  • 17
  • 27
  • Yes, I also suppose I followed those steps... At least I started there, and then I might have gone off-rail at some point. (I think `gem install cocoapods` did not work for me, so I ended up installing Homebrew and running `brew install cocoapods` for example...) And when I said "manually install pods", I meant adding them in XCode somehow... I was checking check-boxes for the packages I wanted... This started a conflict with the Flutter project leading to this error: https://stackoverflow.com/questions/50718018/xcode-10-error-multiple-commands-produce/52993695 That thread solved that error – Karolina Hagegård Aug 16 '22 at 15:30
  • You said: "For step 4, if you added firebase with swift package manager, remove it from your packages." What exactly do you mean "remove it from your packages". Where are those packages, and how do I remove them? – Karolina Hagegård Aug 16 '22 at 15:34
  • can you put the doc you followed here? I don't know how did you add them in Xcode – JIE WANG Aug 16 '22 at 19:17
  • I'm not even sure I could find it again... But more importantly, can you PLZ answer me this instead now: https://stackoverflow.com/questions/73366092/debug-connection-drops-between-android-studio-and-ios-simulator-iphone-13 ? – Karolina Hagegård Aug 17 '22 at 10:49