3

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

Daniel
  • 20,420
  • 10
  • 92
  • 149

1 Answers1

5

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.

Simon McLoughlin
  • 8,293
  • 5
  • 32
  • 56
  • I added a tag called [0.2.2](https://github.com/dkk/UIView-Autolayout/releases/tag/0.2.2), but I''m still getting the wrong version – Daniel May 06 '15 at 13:18
  • I changed the line to `s.source = { :git => 'https://github.com/dkk/UIView-Autolayout.git', :tag => s.version.to_s }` and set the tag 0.2.2 to the last commit, but it still doesn't work :( – Daniel May 06 '15 at 14:09
  • @simpleBob are you still getting the same error `Installing UIView-Autolayout 0.2.1 (was 0.2.1)`? – Simon McLoughlin May 06 '15 at 14:11
  • yes, also, it says `Pre-downloading: 'UIView-Autolayout' from 'https://github.com/dkk/UIView-Autolayout.git', commit '111dd0f4572e562802fea3b06d7168849a7e3e0d'`, which is the wrong commit – Daniel May 06 '15 at 14:15
  • 2
    @simpleBob It all looks right to me, only guess is maybe theres some issue with it changing repos? Maybe something is being cached in the pods.lock file. Have you tried commenting out this pod (place a hash symbol at the start of the line), running pod install. Then uncommenting it and running pod install again? – Simon McLoughlin May 06 '15 at 14:23
  • that worked! ahh, good ol' "have you tried turning it off and on again" exists for a reason :) – Daniel May 06 '15 at 14:26
  • 1
    You are a life-saver @SimonMcLoughlin – Guven Oct 31 '18 at 07:53