简体   繁体   English

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

[英]Uninstall/remove Carthage from iOS/Xcode project?

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 Carthage in future again because of some errors.它还在项目文件中添加了一些更改,因此我可以简单地删除额外的文件/文件夹,它会起作用,但由于某些错误,我将来无法再次使用Carthage

And of course there is no concrete instruction how to do it on its official page.当然,在其官方页面上没有具体说明如何操作。

To completely remove Carthage and its frameworks from project:要从项目中完全删除 Carthage 及其框架:

  1. In Finder, delete these files and directory from your project's root folder:在 Finder 中,从项目的根文件夹中删除这些文件和目录:

     Cartfile Cartfile.resolved Carthage/
  2. In Xcode, delete the framework item in the project navigator.在 Xcode 中,删除项目导航器中的框架项。

  3. In Xcode > project Target > Build Phases tab ( illustration ), delete the carthage copy-frameworks Run Script (if you had previously added it).在 Xcode > project Target > Build Phases 选项卡(插图)中,删除carthage copy-frameworks Run Script(如果您之前添加了它)。

You can always download the framework you need from github and add it back in manually.您可以随时从 github 下载您需要的框架,然后手动重新添加。 (Or follow @tfrank377's answer). (或按照@tfrank377 的回答)。

See also也可以看看

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.我只是将我的框架从 Carthage 文件夹复制到我的主项目文件夹中的框架文件夹中。
  2. Make sure they are added back to the Xcode project from their new location.确保将它们从新位置添加回 Xcode 项目。
  3. Search the entire project in Find navigator for references to Carthage.在 Find navigator 中搜索整个项目以获取对 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.只要您有对非 Carthage 框架文件夹的引用,您就应该能够删除 Carthage 引用。
  4. Lastly, remove the copy-frameworks run script put in place to keep your Carthage frameworks up to date.最后,删除为使您的 Carthage 框架保持最新而放置的copy-frameworks运行脚本。 Simply click the x in the top right只需单击右上角的 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 项目中删除,同时保留您想要的框架。

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.最好循序渐进,这意味着如果您使用 Carthage 安装了四 (4) 个框架,只需一次删除一个框架,在每次删除成功后在设备和模拟器上构建并运行以查看最终结果。 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.即使您需要首先删除这 4 个框架中的任何框架,请清理您的项目,然后使用您想要的另一种机制在您的项目中重新插入所需的框架。
    1. From ProjectNavigator > Build Phases remove the reference of the framework从 ProjectNavigator > Build Phases 删除框架的引用
    2. From Cartfile & Cartfile.resolved remove all references of the frameworks and save从 Cartfile 和 Cartfile.resolved 中删除框架的所有引用并保存
    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在 Xcode 提供选项时,选择删除所有引用
    4. Go to terminal and cd/Path to.转到终端和 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)运行命令 Carthage update --platform iOS(您必须根据项目的用途选择平台,因此如果 iOS 选择 iOS 或根据您的选择选择)
    6. Let the Carthage download all dependencies again让 Carthage 再次下载所有依赖项
    7. Build & Run构建和运行
    8. Repeat steps from 2 to 8 till you have no framework left重复步骤 2 到 8,直到没有框架
    9. Search in Finder a).Cartfile b).Cartfile.resolved c).在 Finder 中搜索 a).Cartfile b).Cartfile.resolved c)。 Carthage/迦太基/

Delete all of these and again clean and build your project.删除所有这些并再次清理并构建您的项目。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM