CocoaPods - 使用特定的pod版本

nei*_*in. 87 cocoapods

我正在使用CocoaPods作为macOS应用程序.我有AFNetworking(当前版本,1.2.1)的编译错误,并发现这些在先前版本(1.2.0)中不存在.

我做了一些研究,但没有找到定义pod版本的可能性(例如,版本1.2.0而不是1.2.1).

这是可能的还是我必须等到该库的新版本?

Mar*_*cel 196

在你的Podfile中:

pod 'AFNetworking', '1.2.0'
Run Code Online (Sandbox Code Playgroud)

http://cocoapods.org上查看"开始使用"

  • 我已经试过了.但它下载了最新版本. (5认同)
  • 请参阅http://cocoapods.org上的文档:'> 0.1任何高于0.1>的版本= 0.1版本0.1和任何更高版本<0.1任何版本低于0.1 <= 0.1版本0.1和任何更低版本〜> 0.1.2版本0.1.2和版本高达0.2,不包括0.2' (5认同)

Sag*_*mar 14

在这里,下面提到了使用用例安装pod的所有可能方法。

  1. 安装最新的Pod版本,请在Pod名称后省略版本号。

    pod 'Alamofire'

  2. 要安装特定的容器版本,请在容器名称后指定容器版本

    pod 'Alamofire', '5.0.0'

    除了没有版本或特定版本以外,还可以使用逻辑运算符:

    • '> 0.1'高于0.1的任何版本
    • '> = 0.1'版本0.1和更高版本
    • '<0.1'任何低于0.1的版本
    • '<= 0.1'版本0.1及更低版本
  3. 安装指定容器版本的最新容器转换

    pod 'Alamofire', '~> 0.1.2'

    • '〜> 0.1.2'版本0.1.2和最高版本0.2,不包括0.2及更高版本
    • '〜> 0.1'版本0.1和不超过1.0的版本,不包括1.0和更高版本
    • '〜> 0'版本0及更高版本,基本上与没有版本相同。
  4. 要从本地计算机文件夹路径使用pod

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

  5. 远程主分支安装Pod

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

  6. 远程特定分支安装Pod

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

  7. 远程分支上的特定标签安装Pod

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

  8. 远程分支上的特定提交安装Pod

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

    要了解更多详细信息,请参阅参考:Cocoa pods安装指南


小智 5

  1. 在您的podfile中,输入:pod'podname','desired version'。
  2. 关闭项目

  3. 运行pod更新或pod安装(如适用)以获取上一步中提到的pod。

  4. 使用所需的pod版本编译代码。