首页 > 解决方案 > 如何使用 Pods 为 xcode 项目创建存储库?

问题描述

我一直在尝试将 Xcode 项目添加到 GitHub 上的存储库中,并且它可以工作,但是 pod 不在项目中并说它们丢失了。将带有 pod 的项目添加到 GitHub 的正确方法是什么?

标签: swiftxcode

解决方案


这取决于您的项目需求是什么。

签入 Pods 目录的好处

After cloning the repo, the project can immediately build and run, even without having CocoaPods installed on the machine. There is no need to run pod install, and no Internet connection is necessary.
The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.

忽略 Pods 目录的好处

The source control repo will be smaller and take up less space.
As long as the sources (e.g. GitHub) for all Pods are available, CocoaPods is generally able to recreate the same installation. (Technically there is no guarantee that running pod install will fetch and recreate identical artifacts when not using a commit SHA in the Podfile. This is especially true when using zip files in the Podfile.)
There won't be any conflicts to deal with when performing source control operations, such as merging branches with different Pod versions.

来源

我个人在我的 .gitignore 文件中有以下内容:

# CocoaPods
#
Pods/

推荐阅读