nein.
nein.

Reputation: 2127

CocoaPods - use specific pod version

I am using CocoaPods for a macOS app. I have compilation errors with AFNetworking (current version, 1.2.1) and saw that these didn't exist in the previous version (1.2.0).

I did some research but did not find a possibility to define the version of a pod (for example, version 1.2.0 instead of 1.2.1).

Is this possible or do I have to wait until there is a new version of that library?

Upvotes: 157

Views: 143515

Answers (4)

Sagar Thummar
Sagar Thummar

Reputation: 2124

Here, below mentions all possible ways to install pod with use cases.

  1. To install the latest pod version, omit the version number after pod name.

    pod 'Alamofire'

  2. To install specific pod version, specify pod version after pod name.

    pod 'Alamofire', '5.0.0'

    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
  3. To install latest pod subversion of specified pod version :

    pod 'Alamofire', '~> 0.1.2'

    • '~> 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.
  4. To use pod from a local machine folder path:

    pod 'Alamofire', :path => '~/Documents/Alamofire'

  5. Install pods from the remote master branch

    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'

  6. Install pods from the remote specific branch

    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'

  7. Install pods from the specific tag on the remote branch

    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.1.1'

  8. Install pods from the specific commit on the remote branch

    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :commit => '0f506b1c45'

    To know more in details, check reference: Cocoa pods installation guideline

Upvotes: 94

Marcel
Marcel

Reputation: 6579

In your Podfile:

pod 'AFNetworking', '1.2.0'

Check 'Get started' at http://cocoapods.org

Once this is done, you can then issue a pod update in the terminal for the change to take place. Of course, this needs to be done from your project's top level folder. If the update does not occur, edit your Podfile.lock file and change the AFNetworking version # to something less than what it is and issue a pod update in the terminal again. This tells CocoaPods that you have a different version installed and that it must update.

Upvotes: 280

user2766004
user2766004

Reputation: 81

  1. In your podfile, write : pod 'podname', 'desired version'.
  2. Close the Project

  3. Run pod update or pod install (as applicable) to get the pods as mentioned in above step.

  4. Compile the code with your desired pod version.

Upvotes: 6

Sudhir
Sudhir

Reputation: 75

Use platform :ios, '8.0'. It will automatically install the previous one which will run on this platform

Upvotes: 0

Related Questions