从项目中删除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

其他回答

我尝试了所有这些答案,但它仍然不会建立,最终我尝试了:

pod deintegrate
pod install

这真的有效!

就好像它需要从构建阶段删除所有的pod脚本,然后重新添加它们才能工作,至少在我的情况下是这样。

我要写什么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阶段。

开发者可能面临两个方面的问题。

要么他想把舱完全从项目中移除 开发人员想从项目中卸载特定的框架 豆荚。

在第一种情况下,你必须使用“豆荚分解”,并遵循以上答案中提到的几个步骤。

第二种情况是,如果你想卸载安装在pod文件中的任何特定框架,很简单的方法就是注释你想卸载的框架,然后运行pod install命令。

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

    pod 'iCarousel', '~> 1.8'
#    pod 'Facebook-iOS-SDK', '~> 4.1'
#    pod 'ParseFacebookUtilsV4', '~> 1.11'
#    pod 'Parse', '~> 1.14'


end

在这里,我想卸载facebook和解析框架(使用pods安装),而不是iCarousel,这就是为什么我像上面那样更新了我的pod文件。

现在如果我运行pod安装,它将保持iCarousel,因为它是在我的项目,并将删除facebook和解析。

你需要做的第一件事是删除Podfile, Podfile。锁、Pods文件夹和生成的工作区。 接下来,在.xcodeproj中,删除对Pods的引用。xcconfig文件和libPods。一个文件。 在Build Phases项目选项卡中,删除Check Pods清单。锁定部分(打开),复制Pods资源部分(底部)和嵌入Pod资源(底部)。 删除Pods.framework。

您唯一要做的就是包含您以前使用过的一些库。你可以通过简单地将pods文件夹中的任何文件夹拖到你的项目中(我更喜欢将它们放在我的Supporting Files文件夹中)来做到这一点。

这对我很管用。