从 iOS/xCode 项目中卸载/删除 Carthage?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32091537/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:41:49  来源:igfitidea点击:

Uninstall/remove Carthage from iOS/xCode project?

iosxcodeuninstallremoveallcarthage

提问by Vyachaslav Gerchicov

Here is a link to Carthage:

这是一个链接Carthage

https://github.com/Carthage/Carthage

https://github.com/Carthage/Carthage

It additionally adds some changes in project files so I can simply remove extra files/folders and it will work but I can't use Carthagein future again because of some errors.

它还在项目文件中添加了一些更改,因此我可以简单地删除额外的文件/文件夹,它会起作用,但Carthage由于一些错误,我将来无法再次使用。

And of course there is no concrete instruction how to do it on its official page.

当然,在其官方页面上没有具体说明如何操作。

采纳答案by tfrank377

Removing Carthage has actually been pretty easy for me.

删除迦太基对我来说实际上很容易。

  1. I simply copy my frameworks from the Carthage folder into a frameworks folder I have in my main project folder.
  2. Make sure they are added back to the Xcode project from their new location.
  3. Search the entire project in Find navigator for references to Carthage. The only ones I found were in the Frameworks search paths under Build Settings. As long as you have a reference to your non-Carthage frameworks folder, you should be able to delete the Carthage references.
  4. Lastly, remove the copy-frameworksrun script put in place to keep your Carthage frameworks up to date. Simply click the x in the top right run script phase xcode
  1. 我只是将我的框架从 Carthage 文件夹复制到我的主项目文件夹中的框架文件夹中。
  2. 确保将它们从新位置添加回 Xcode 项目。
  3. 在 Find navigator 中搜索整个项目以获取对 Carthage 的引用。我发现的唯一一个是在构建设置下的框架搜索路径中。只要您有对非 Carthage 框架文件夹的引用,您就应该能够删除 Carthage 引用。
  4. 最后,删除copy-frameworks为使您的 Carthage 框架保持最新而放置的运行脚本。只需单击右上角的 x 运行脚本阶段 xcode

You should always be able to add Carthage back if you want, but these steps should remove it from a particular Xcode project, while keeping the frameworks you want.

如果需要,您应该始终能够重新添加 Carthage,但是这些步骤应该将它从特定的 Xcode 项目中删除,同时保留您想要的框架。

回答by Suragch

To completely remove Carthage and its frameworks from project:

要从项目中完全删除 Carthage 及其框架:

  1. In Finder, delete these files and directory from your project's root folder:

    Cartfile
    Cartfile.resolved
    Carthage/
    
  2. In Xcode, delete the framework item in the project navigator.

  3. In Xcode > project Target > Build Phases tab (illustration), delete the carthage copy-frameworksRun Script (if you had previously added it).

  1. 在 Finder 中,从项目的根文件夹中删除这些文件和目录:

    Cartfile
    Cartfile.resolved
    Carthage/
    
  2. 在 Xcode 中,删除项目导航器中的框架项。

  3. 在 Xcode > project Target > Build Phases 选项卡(插图)中,删除carthage copy-frameworks运行脚本(如果您之前添加了它)。

You can always download the framework you need from github and add it back in manually. (Or follow @tfrank377's answer).

您可以随时从 github 下载您需要的框架,然后手动重新添加。(或按照@tfrank377 的回答)。

See also

也可以看看

回答by Nikhil Pandey

I have almost spent a week and now can say to remove Carthage safely and without any side effects there are following step by step process

我几乎花了一个星期,现在可以说安全地移除迦太基,没有任何副作用,有以下一步一步的过程

  1. It's better to do it step by step, means if you have installed four (4) frameworks using Carthage just go by removing one framework at a time and after each removal successfully build and run on device and simulator to see the final result. And even if you need any framework out of those 4 first delete, clean your project and then reinsert the needed framework in your project using another mechanism you want.
    1. From ProjectNavigator > Build Phases remove the reference of the framework
    2. From Cartfile & Cartfile.resolved remove all references of the frameworks and save
    3. Remove Framework from the left-hand side of the project navigator (where you see the entire file structure) by selecting the framework and pressing delete. On being given the option by Xcode select remove all references
    4. Go to terminal and cd/Path to. your project
    5. Run the command Carthage update --platform iOS (platform you have to choose as per what project is meant for so if iOS select iOS or else select as per your choice)
    6. Let the Carthage download all dependencies again
    7. Build & Run
    8. Repeat steps from 2 to 8 till you have no framework left
    9. Search in Finder a).Cartfile b).Cartfile.resolved c). Carthage/
  1. 最好循序渐进,这意味着如果您使用 Carthage 安装了四 (4) 个框架,只需一次删除一个框架,在每次删除后成功构建并在设备和模拟器上运行以查看最终结果。即使您需要首先删除这 4 个框架中的任何框架,请清理您的项目,然后使用您想要的另一种机制在您的项目中重新插入所需的框架。
    1. 从 ProjectNavigator > Build Phases 删除框架的引用
    2. 从 Cartfile & Cartfile.resolved 删除所有框架的引用并保存
    3. 通过选择框架并按删除,从项目导航器的左侧(您可以在其中看到整个文件结构)删除框架。在被 Xcode 提供选项时,选择删除所有引用
    4. 转到终端和 cd/Path to。你的项目
    5. 运行命令 Carthage update --platform iOS(您必须根据项目的用途选择平台,因此如果 iOS 选择 iOS 或根据您的选择选择)
    6. 让 Carthage 再次下载所有依赖项
    7. 构建和运行
    8. 重复步骤 2 到 8,直到没有框架
    9. 在 Finder 中搜索 a).Cartfile b).Cartfile.resolved c)。迦太基/

Delete all of these and again clean and build your project.

删除所有这些并再次清理并构建您的项目。