0

Cocoapods and Xcode are both the latest version

I have a pod whose repo I am linking directly in my podfile, and specifying to use version 1.5.0 (that has been released as a version on Github). However, whenever I run pod install and pod update, Cocoapods keeps fetching verision 1.4.1 of my repo (the previous Github release).

Here is the relevant line my podfile:

pod 'podName', :git=> 'git repo'

I've tried deleting Podfile.lock and redownloading pods, and I've made sure that the newest version of the pod is actually pushed to Github.

Kevin2566
  • 425
  • 8
  • 20
  • can you post the actual line where you specify to use 1.5.0? Did you run `pod repo update` as well? – Olympiloutre Oct 01 '19 at 01:53
  • have you tried running `pod repo update` to update to the latest available pods? – valosip Oct 01 '19 at 01:53
  • I never specify a version to use, which I believe means that Cocoapods will use the most recent version of the pod. I have tried `pod repo update` which still keeps version 1.4.1. – Kevin2566 Oct 01 '19 at 02:27

2 Answers2

2

Without knowing which pod and seeing your code for using the exact version, its hard to tell whats wrong.

But I'd run pod repo update Then run pod install

This will update your local pods to the newest available versions, and then install the right pod version assuming you're setting it correctly.

Cocoapod documentation on versions:

Besides no version, or a specific one, it is also possible to use logical operators:

'> 0.1' Any version higher than 0.1
'>= 0.1' Version 0.1 and any higher version
'< 0.1' Any version lower than 0.1
'<= 0.1' Version 0.1 and any lower version
In addition to the logic operators CocoaPods has an optimistic operator ~>:

'~> 0.1.2' Version 0.1.2 and the versions up to 0.2, not including 0.2 and higher
'~> 0.1' Version 0.1 and the versions up to 1.0, not including 1.0 and higher
'~> 0' Version 0 and higher, this is basically the same as not having it.


To use the master branch of the repo:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'

To use a different branch of the repo:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'

To use a tag of the repo:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.1.1'

Or specify a commit:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :commit => '0f506b1c45'
valosip
  • 3,167
  • 1
  • 14
  • 26
  • Specifying a version, ie like `pod 'podName', :git=> 'git repo', '1.5.0'` gives me a `syntax error, unexpected keyword_do_block, expecting keyword_end installer.pods_project.targets.each do |target|` error Specifying the specific commit where I included these new changes for version 1.5.0 still downloads the 1.4.1 version. – Kevin2566 Oct 01 '19 at 02:31
  • @Kevin2566 Do you mind sharing which cocoapod this is for? Is this a private or public cocoapod? – valosip Oct 01 '19 at 02:34
  • It's a private cocoapod (well technically public repo, but I don't want to share it along with my identity) which is why I'm reluctant to post the actual code. However the code that I've posted is exactly as it is in my Podfile just with the pod and repo names edited out. – Kevin2566 Oct 01 '19 at 02:54
  • @Kevin2566 Ok, I get that, have you made sure that you made the pod version accessible by setting the tag and repo push? https://guides.cocoapods.org/making/using-pod-lib-create.html && https://medium.com/@shahabejaz/create-and-distribute-private-libraries-with-cocoapods-5b6507b57a03 I have a strong suspicion, a step was missed and thats why it's not working properly, I know I've done that in the past with private pods/repos. – valosip Oct 01 '19 at 03:34
  • I tried pushing the '1.5.0' tag but got an `hint: Updates were rejected because the tag already exists in the remote.` error. – Kevin2566 Oct 01 '19 at 05:27
  • If tag already exists, make sure that you did the pod repo push/pod repo add (depending on how the pod is set up). You could always delete the tag and re push a new one with the correct branch/etc... hard to tell exactly whats going on without being able to see pod – valosip Oct 01 '19 at 06:16
0

Try this:

pod 'podName', :git => 'git repo', :tag => '1.5.0'

If it can't find the tag, you probably has an error in your .podspec file inside the tagged version.

However, you would still be able to install the tag like this:

pod 'podName', :git => 'git repo', :branch => '1.5.0'
alxlives
  • 5,084
  • 4
  • 28
  • 50