简体   繁体   English

如何从 Flutter 项目中删除 Cocoapod 豆荚?

[英]How do I remove Cocoapod pods from a Flutter project?

I have a Flutter app that runs fine on Android devices.我有一个在 Android 设备上运行良好的 Flutter 应用程序。 It has a Firebase Firestore backend.它有一个 Firebase Firestore 后端。

Now, I want to build it on an iOS simulator, and so I need to initialize the Firebase iOS app.现在,我想在 iOS 模拟器上构建它,所以我需要初始化 Firebase iOS 应用程序。 (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! (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 ) 这是将 Firebase 添加到 Flutter iOS 项目的具体说明

But before doing it right, I want to remove the pods that Cocoapods installed for me.但在正确之前,我想删除 Cocoapods 为我安装的 pod。 Only I don't know how, When I web-search, I'm told to delete the pods I don't want from the Podfile .只有我不知道如何,当我进行网络搜索时,我被告知要从Podfile中删除我不想要的 pod。 Only there ARE no pods in my ios/Podfile : There's only a bit that says:只有在我的ios/Podfile中没有 pod:只有一点说:

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?还有一个ios/Podfile.lock文件,那个有一个所有 pod 的列表……然后,有一个ios/Pods/Manifest.lock文件,它也有这样一个列表……所以我应该删除而不是这两个文件之一中不需要的 pod 名称?

Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile ?否则,当 Cocoapods pod 未在ios/Podfile中列出时,如何卸载它们?

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!原来从 Flutter 项目中安装和删除 pod 的正确方法只是编辑根目录中的pubspec.yaml文件!

Cocoapods needs to be installed, but it will automatically read the pubspec.yaml file and do the work from there! Cocoapods 需要安装,但它会自动读取pubspec.yaml文件并从那里开始工作! No need to run pod commands from terminal or otherwise.无需从终端或其他方式运行pod命令。

I suppose you followed these steps?我想你遵循了这些步骤? in this case, you don't need to remove pods.在这种情况下,您不需要删除 pod。 For step 1, step 2, it should be fine.对于第1步,第2步,应该没问题。 For step 3, just remove the config file.对于第 3 步,只需删除配置文件。 For step 4, if you added firebase with swift package manager, remove it from your packages.对于第 4 步,如果您添加了 firebase 和 swift package 管理器,请将其从您的包中删除。

I'm supposed to let the Flutter framework do most of this work, rather than adding pods manually!我应该让 Flutter 框架完成大部分工作,而不是手动添加 pod!

How did you add pods manually?你是如何手动添加 pod 的? from your Podfile, I didn't see any new added pods.从您的 Podfile 中,我没有看到任何新添加的 pod。

Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile?否则,当我的 Cocoapods pod 未在 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.你不需要做任何事情,在最坏的情况下,只需删除Podfile并重新运行应用程序,让 flutter 重新生成它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Kubernetes 复制 controller 的所有 pod 获取日志? - How do I get logs from all pods of a Kubernetes replication controller? 如何通过 flutter 中的文档从 firebase 存储中检索数据? - How do i retrieve data from firebase store by document in flutter? 如何从项目中完全删除 Cloud Datastore? - How do I completely delete Cloud Datastore from a project? 在谷歌云 Kube.netes 集群中,我的 pod 有时会全部重启,我如何找到重启的原因? - in a google cloud Kubernetes cluster my pods sometimes all restart, how do I find the reason for the restart? Flutter:如何从设备本身发送推送通知? - Flutter: How do I send a push notification from the device itself? 在 Flutter Google 地图中,我如何根据实时数据库侦听器添加和删除标记? - In Flutter Google Maps how do I add and remove markers based on a realtime database listener? 如何运行具有 Gradle 构建错误的旧 Flutter 项目? - How do I run older Flutter Project that has Gradle build errors? 如何使用 flutter 从 Firestore 获取子集合? - How do I fetch sub collection from firestore using flutter? 如何从 firebase crashlytics 中删除设备? - How do i remove a device from firebase crashlytics? 如何从项目中删除 Firebase 产品(或功能)? - How do I delete a Firebase product (or feature) from a project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM