如何从项目中删除 CocoaPods? [英] How to remove CocoaPods from a project?

查看:31
本文介绍了如何从项目中删除 CocoaPods?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从项目中删除 CocoaPods 的正确方法是什么?我想删除整个 CocoaPod.由于我的客户施加的一些限制,我无法使用它.我只需要一个 xcodeproj 而不是 xcworkspace.

What's the right way of removing CocoaPods from a project? I want to remove the whole CocoaPod. Due to some limitations imposed by my client I can't use it. I need to have just one xcodeproj instead of an xcworkspace.

推荐答案

从项目中删除 CocoaPods 是可能的,但目前不能由 CLI 自动执行.首先,如果您遇到的唯一问题是无法使用 xcworkspace,您可以使用 --no-integrate 标志将产生 Pods.xcodeproj 但不是工作区.然后您可以将此 xcodeproj 作为子项目添加到您的主 xcodeproj.

Removing CocoaPods from a project is possible, but not currently automated by the CLI. First thing, if the only issue you have is not being able to use an xcworkspace you can use CocoaPods with just xcodeprojs by using the --no-integrate flag which will produce the Pods.xcodeproj but not a workspace. Then you can add this xcodeproj as a subproject to your main xcodeproj.

如果你真的想删除所有 CocoaPods 集成,你需要做一些事情:

If you really want to remove all CocoaPods integration you need to do a few things:

注意如果不正确地编辑其中一些内容可能会破坏您的主要项目.我强烈建议您将项目检查到源代码管理中以防万一.此外,这些说明适用于 CocoaPods 版本 0.39.0,它们可能会随着新版本的变化而变化.

NOTE editing some of these things if done incorrectly could break your main project. I strongly encourage you to check your projects into source control just in case. Also these instructions are for CocoaPods version 0.39.0, they could change with new versions.

  1. 删除独立文件(Podfile Podfile.lock 和您的 Pods 目录)
  2. 删除生成的xcworkspace
  3. 打开你的 xcodeproj 文件,删除对 Pods.xcconfiglibPods.a 的引用(在 Frameworks> 组)
  4. 在您的 Build Phases 下,删除 Copy Pods ResourcesEmbed Pods FrameworksCheck Pods Manifest.lock阶段.
  5. 这似乎很明显,但您需要以其他方式集成第 3 方库或从代码中删除对它们的引用.
  1. Delete the standalone files (Podfile Podfile.lock and your Pods directory)
  2. Delete the generated xcworkspace
  3. Open your xcodeproj file, delete the references to Pods.xcconfig and libPods.a (in the Frameworks group)
  4. Under your Build Phases delete the Copy Pods Resources, Embed Pods Frameworks and Check Pods Manifest.lock phases.
  5. This may seem obvious but you'll need to integrate the 3rd party libraries some other way or remove references to them from your code.

在这些步骤之后,您应该使用集成 CocoaPods 之前存在的单个 xcodeproj 进行设置.如果我遗漏了任何内容,请告诉我,我会对其进行编辑.

After those steps you should be set with a single xcodeproj that existed before you integrated CocoaPods. If I missed anything let me know and I will edit this.

此外,我们一直在寻找有关如何改进 CocoaPods 的建议,因此如果您遇到问题,请在我们的问题跟踪器 这样我们就可以想出一种方法来修复它们!

Also we're always looking for suggestions for how to improve CocoaPods so if you have an issues please submit them in our issue tracker so we can come up with a way to fix them!

编辑

显示Jack Wu 在评论中有一个第三方 CocoaPods 插件可以为您自动执行这些步骤.可以在此处找到.请注意,它是第三方插件,当 CocoaPods 更新时,它可能不会总是更新.另请注意,它是由 CocoaPods 核心团队成员制作的,因此问题不会成为问题.

As shown by Jack Wu in the comments there is a third party CocoaPods plugin that can automate these steps for you. It can be found here. Note that it is a third party plugin and might not always be updated when CocoaPods is. Also note that it is made by a CocoaPods core team member so that problem won't be a problem.

这篇关于如何从项目中删除 CocoaPods?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆