【问题标题】:cocoapods not updating a repository correctlycocoapods 没有正确更新存储库
【发布时间】:2015-07-16 15:31:13
【问题描述】:

在更新我的项目时,其中包含Podfile 中的这一行:

pod 'UIView-Autolayout', :git => 'https://github.com/dkk/UIView-Autolayout.git'

使用命令pod update 我想更新the pod in this github repository,它具有以下podspec:

Pod::Spec.new do |s|
  s.name         = 'UIView-Autolayout'
  s.version      = '0.2.2'
  s.license      = 'MIT'
  s.platform     = :ios, '6.0'

  s.summary      = 'Category on UIView to simplify the creation of common layout constraints.'
  s.homepage     = 'https://github.com/jrturton/UIView-Autolayout'
  s.author       = { 'Richard Turton' => 'jrturton@gmail.com' }
  s.source       = { :git => 'https://github.com/jrturton/UIView-Autolayout.git', :tag => s.version.to_s }

  s.source_files = 'Source/*.{h,m}'

  s.requires_arc = true
end

我得到的输出是:Installing UIView-Autolayout 0.2.1 (was 0.2.1)。为什么不安装版本0.2.2??

(我的项目是iOS7.0,带ARC)

如果我用pod 'UIView-Autolayout', :git => 'https://github.com/dkk/UIView-Autolayout.git', '0.2.2' 替换Podfile 行,我会得到一个错误

【问题讨论】:

    标签: ios github cocoapods podspec


    【解决方案1】:

    该仓库没有0.2.2 版本的标签,直到开发者/贡献者添加标签后才会更新。

    Cocoapods 使用这个值:

    s.version      = '0.2.2'
    

    通过查找与字符串完全匹配的标签名称。

    编辑

    源还需要指向你的仓库:

    s.source       = { :git => 'https://github.com/jrturton/UIView-Autolayout.git', :tag => s.version.to_s }
    

    编辑 2

    似乎注释掉 pod(在行首放置一个哈希)并运行 pod install(删除它),然后取消注释并再次运行 pod install 是必要的。

    直觉是 pods.lock 文件缓存了一些东西,不想切换到同一个库的新 repo。

    【讨论】:

    • 我添加了一个名为 0.2.2 的标签,但我仍然得到错误的版本
    • 我将这一行改为s.source = { :git => 'https://github.com/dkk/UIView-Autolayout.git', :tag => s.version.to_s },并将标签0.2.2设置为最后一次提交,但还是不行:(
    • @simpleBob 你是否仍然遇到同样的错误Installing UIView-Autolayout 0.2.1 (was 0.2.1)
    • @simpleBob 对我来说这一切看起来都不错,只是猜测可能是它改变 repos 有一些问题?也许某些东西被缓存在 pods.lock 文件中。您是否尝试过注释掉这个 pod(在行首放置一个井号),运行 pod install。然后取消注释并再次运行 pod install?
    • 你是救生员@SimonMcLoughlin
    猜你喜欢
    • 1970-01-01
    • 2022-01-19
    • 2019-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多