1

我看到某些 pod 文件仅提及 pod 的名称(pod 'podName'),但某些 pod 及其 git url(pod 'podName' , :git => 'open source git url')......我也倾向于有一种这样的情况,当我只用它的名字提到 pod 而没有它的 git url 时,我得到了错误。那么它真的有什么区别呢?“ pod 'podName' ” vs “ pod 'podName', :git => 'open source git url' ” 在 pod 文件中?对于某些 pod,如果我只使用 pod 名称进行 pod 安装,该名称只是给出一些错误,这似乎只与它的 git url 一起工作。那么什么时候需要指定 git url 而什么时候不需要呢?

4

2 回答 2

3

使用 URL,您可以指定 fork、branch、tag 或 commit。

有时您可能想要使用 Pod 的最新版本、特定修订版或您自己的 fork。如果是这种情况,您可以在 pod 声明中指定。

要使用 repo 的主分支: pod 'Alamofire', :git => ' https://github.com/Alamofire/Alamofire.git '

要使用 repo 的不同分支: pod 'Alamofire', :git =>' https://github.com/Alamofire/Alamofire.git ', :branch => 'dev'

要使用 repo 的标签: pod 'Alamofire', :git => ' https://github.com/Alamofire/Alamofire.git ', :tag => '3.1.1'

或者指定一个提交: pod 'Alamofire', :git => ' https://github.com/Alamofire/Alamofire.git ', :commit => '0f506b1c45'

https://guides.cocoapods.org/using/the-podfile.html#from-a-podspec-in-the-root-of-a-library-repo

于 2018-02-12T09:34:41.430 回答
1

通过添加git参数,您可以指定应用作基本代码的 pod 库的特定 git 存储库。在这种情况下,pod 将使用 git 存储库中的源代码,而不是提交给 pod 服务器的版本。

阅读文档以了解更多信息,在某些情况下,您可能希望使用git参数而不是官方 pod 版本:

有时您可能想要使用 Pod 的最新版本、特定修订版或您自己的 fork。

于 2018-02-12T09:30:04.220 回答