Search code examples
iosgithubcocoapodspodspec

cocoapods not updating a repository correctly


While updating my project, which contains this line in the Podfile:

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

with the command pod update I want to update the pod in this github repository, which has following 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

As output I get: Installing UIView-Autolayout 0.2.1 (was 0.2.1). Why does it not install version 0.2.2??

(My project is iOS7.0, with ARC)

If I replace the Podfile line with pod 'UIView-Autolayout', :git => 'https://github.com/dkk/UIView-Autolayout.git', '0.2.2' I get an error


Solution

  • That repo doesn't have a tag for version 0.2.2 it won't update until the developer / contributor adds a tag.

    Cocoapods uses this value:

    s.version      = '0.2.2'
    

    by looking for a tag name that matches the string exactly.

    EDIT

    The source will also need to point to your repo:

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

    EDIT 2

    It seems commenting out the pod (placing a hash at the beginning of the line) and running pod install (to remove it), then uncommenting and running pod install again was necessary.

    Gut feeling is that the pods.lock file had something cached and didn't want to switch to a new repo for the same library.