可可豆和迦太基 [英] CocoaPods and Carthage

查看:70
本文介绍了可可豆和迦太基的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于迦太基和可可足类的项目。它们都有一个共同的依赖关系(准确地说是PureLayout)。奇怪,但项目编译良好,而没有关于类重新声明等的任何错误。
所以问题是:为什么有效,当我调用PureLayout的方法时,实际使用的是哪个版本的依赖项-迦太基或Cocoapods的方法?

I had a project with both Carthage and Cocoapods. They both have one common dependency (PureLayout, to be precise). Strange, but project compiles fine without any errors about class redeclaration, etc. So the question is: why it works and which version of dependency is actually used when I call PureLayout's methods – Carthage's or Cocoapods' one?

推荐答案

迦太基 CocoaPods 在构建依赖项并将其集成到项目方面有很大的不同。

Carthage and CocoaPods are very different in terms of building the dependencies and integrating them in the project.

CocoaPods是集中式依赖项管理器,它将通过创建新的 .xcworkspace 工作区。

CocoaPods is centralized dependency manager and it will build your dependencies and integrate them directly in the project by creating new .xcworkspace workspace. This means that you get access to the build dependencies right after building.

另一方面,Carthage是分散的依赖项管理器,它使您可以将依赖项集成到您的项目。迦太基将构建 Cartfile 中指定的框架,并将其移至 Carthage / Builds 文件夹中。构建过程完成后,您可以自行集成和管理依赖项。

Carthage on the other hand is decentralized dependency manager and it leaves you with the task of integrating the dependencies into your project. Carthage builds the frameworks specified in Cartfile and moves them to Carthage/Builds folder. After the build process it's up to you to integrate and manage the dependencies.

在您的情况下,当您使用CocoaPods和Carthage构建 PureLayout 依赖项时,CocoaPods将其集成到了Project和Carthage中给您留下了 Carthage / Builds 中的构建,这意味着您仅使用了 PureLayout 的CocoaPods构建版本。

In your case, when you build your PureLayout dependency with CocoaPods and Carthage, CocoaPods integrated it to project and Carthage left you with builds in Carthage/Builds which means that you used only CocoaPods build version of PureLayout.

此外,使用多个程序包/依赖项管理器也是一种不好的做法。您应该坚持使用它并对此感到满意。

Also, it's a bad practice to use multiple package/dependency managers. You should stick to the one and be comfortable with it.

这篇关于可可豆和迦太基的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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