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


当前回答

使用这些终端的命令(不要忘记在新行开始使用sudo):

open:YourDir YouName$ sudo gem uninstall cocoapods
Password:?
Remove executables:
    pod, sandbox-pod

in addition to the gem? [Yn]  Y
Removing pod
Removing sandbox-pod
Successfully uninstalled cocoapods-1.4.0
open:YourDir YourName$ gem list --local | grep cocoapods
cocoapods-core (1.4.0)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.1.3)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.0)
cocoapods-try (1.1.0)

逐个卸载列表,如下所示:

open:YourDir YourName$ sudo gem uninstall cocoapods-core
Successfully uninstalled cocoapods-core-1.4.0
open:YourDir YourName$ sudo gem uninstall cocoapods-trunk
Successfully uninstalled cocoapods-trunk-1.3.0
open:YourDir YourName$ sudo gem uninstall cocoapods-try
Successfully uninstalled cocoapods-try-1.1.0
open:YourDir YourName$ gem list --local | grep cocoapods
open:YourDir YourName$ sudo gem uninstall cocoapods-stats
Successfully uninstalled cocoapods-stats-1.0.0
open:YourDir YourName$ sudo gem uninstall cocoapods-search
Successfully uninstalled cocoapods-search-1.0.0
open:YourDir YourName$ sudo gem uninstall cocoapods-downloader
Successfully uninstalled cocoapods-downloader-1.1.3
open:YourDir YourName$ sudo gem uninstall cocoapods-plugins
Successfully uninstalled cocoapods-plugins-1.0.0
open:YourDir YourName$ gem list --local | grep cocoapods
cocoapods-deintegrate (1.0.2)
open:YourDir YourName$ sudo gem uninstall cocoapods-deintegrate
Successfully uninstalled cocoapods-deintegrate-1.0.2
open:YourDir YourName$ sudo gem uninstall cocoapods-stats
Successfully uninstalled cocoapods-stats-1.0.0
open:YourDir YourName$ sudo gem uninstall cocoapods-search
Successfully uninstalled cocoapods-search-1.0.0
open:YourDir YourName$ sudo gem uninstall cocoapods-downloader
Successfully uninstalled cocoapods-downloader-1.1.3
open:YourDir YourName$ sudo gem uninstall cocoapods-plugins
Successfully uninstalled cocoapods-plugins-1.0.0
open:YourDir YourName$ gem list --local | grep cocoapods
cocoapods-deintegrate (1.0.2)
open:YourDir YourName$ sudo gem uninstall cocoapods-deintegrate
Successfully uninstalled cocoapods-deintegrate-1.0.2

其他回答

我要写什么iv做的很简单(删除任何CocoaPods从我的项目)..

删除任何已添加的文件夹(框架,Pods,…) 删除任何添加的文件(PROJECT.)xcworkspace PodFile PodFile锁,pod - project .debug.xcconfig, pod - project .release.xcconfig… 只需保留您原来的(PROJECT, PROJECT_Tests, PROJECT.xcodeproj) 从xcode的项目中删除框架引用

从xcode中删除框架引用:

使用项目导航器 选择项目 选择目标项目 从顶部选项中选择Build Phases 保留默认组(目标依赖项、编译源、带有库的链接二进制文件、复制Bundle资源)并删除其他组

我觉得你不需要再分解了。我可以在终端中使用以下命令做到这一点:

正在安装

它会自动删除那些不在播客文件中的

Keith的回答很好——我只是想指出,因为Cocoapods 0.36开始支持动态框架,如果你正在使用“use_frameworks!”,并且你希望移除Cocoapods,你必须这样做:

在Build Phases下删除Embed Pods Frameworks阶段。

我觉得有更简单的方法。

根据公认的答案编辑,现在你可以使用第三方插件CocoaPods -deintegrate,它是可靠的,因为它是由CocoaPods核心团队成员制作的。

但是,仍然有一些文件遗留下来:

Podfile
Podfile.lock
Workspace

你可以手动将它们从你的项目中删除,但还有另一个工具可以帮助你清理它们,感谢cocoapodd -clean。

最后,卸载工作仍未完成,cocoapods-clean不清理Podfile,只需运行:

rm Podfile

干杯!

在删除之前,你应该确保你有一个备份的项目!

从.plist中删除podfile名称 重新安装吊舱(使用此链接安装吊舱)