Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to lock down CocoaPod library version?

There are currently newer versions of libraries I have specified in my Podfile which break our applications build . It happens when you perform a pod update. This is because our Podfile has fuzzy matching versions specified for some of the libraries. We need to lock these down to specific versions , example I have AFNetworking, '~> 1.0 in my pod file , When I perform a "pod update" then it install AFNetworking', '~> 1.3.3 , but I wanted lock down library to 1.0 only.

like image 342
hkm Avatar asked Dec 30 '13 07:12

hkm


2 Answers

According to the podfile syntax reference, you can use operators to specify the version of the pod you want to install:

  • > 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
  • ~> 0.1.2 Version 0.1.2 and the versions up to 0.2, not including 0.2

However, in your case it sounds like you want to use just the version number and "freeze" it to 1.0, right? If yes, you can just write

pod 'AFNetworking', '1.0'

in your podfile.

Note that the ~> symbol you are using will update up to version 2.0, not including 2.0.

like image 126
phi Avatar answered Sep 23 '22 10:09

phi


When you update your pod library Try this command;

pod update --no-repo-update

or

pod install --no-repo-update

so that your current libraries won't be updated.

Here is the link, you can find more details

http://guides.cocoapods.org/terminal/commands.html#pod_update http://guides.cocoapods.org/terminal/commands.html#pod_install

like image 35
ethem Avatar answered Sep 23 '22 10:09

ethem