git CocoaPods:指向 pod 规范中的一个分支

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25140362/
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-19 10:16:50  来源:igfitidea点击:

CocoaPods: point to a branch in pod spec

iosgitcocoacocoapodspodspec

提问by DZenBot

I'm trying to install code from a repository's branch on a pod spec, and based on the documentation, this should work:

我正在尝试从 pod 规范上的存储库分支安装代码,并且根据文档,这应该可以工作:

s.dependency 'repository_name',
:git => 'https://github.com/account_name/repository_name.git',
:branch => 'experimental_branch'

But I get an error with something like [!] Unsupported version requirements. Updating CocoaPods might fix the issue.

但是我收到类似[!] 不支持的版本要求的错误。更新 CocoaPods 可能会解决这个问题。

It works when installing from a pod file directly:

它在直接从 pod 文件安装时有效:

pod 'ObjectiveRecord', :git => 'https://github.com/supermarin/ObjectiveRecord.git', :branch => '2-0-experimental'

Does anyone know? Thanks!

有人知道吗?谢谢!

回答by orta

You can't use a pod dependency like that, it only supports "name", "version". Source: guides.cocoapods.org. It is expected that the :gitand :branchmetadata will come from the podfile.

您不能使用这样的 pod 依赖项,它只支持"name", "version". 来源:guides.cocoapods.org。预计:git:branch元数据将来自 podfile。

回答by Vijay Sharma

Please check the discussion here - Link

请在此处查看讨论 -链接

I think it is possible now as per the discussion but initially -

我认为现在根据讨论是可能的,但最初 -

They suggested Taginstead of the branchas the problem with a branch vs a tag is that a branch does not specify a specific point in the history, whereas a tag does. This distinction is very important, as we need to guarantee that depending on a specific version of the library will result in using the same source every time. Technically it is possible to delete a tag and create it again pointing to a different commit, but this is less likely to happen.

他们建议标记而不是分支,因为分支与标记的问题在于分支没有指定历史记录中的特定点,而标记则指定。这种区别非常重要,因为我们需要保证依赖于特定版本的库将导致每次使用相同的源。从技术上讲,可以删除一个标签并再次创建它指向不同的提交,但这不太可能发生。