【问题标题】:Getting non-master branch from Cocoapods?从 Cocoapods 获取非主分支?
【发布时间】:2015-09-28 19:34:13
【问题描述】:
我一直在一个项目中使用SwiftyJSON 和Alamofire。最近我下载了 XCode 7 beta。 SwiftyJSON 和 Alamofire 都为 Swift 2 提供了单独的非主分支。有没有办法通过 CocoaPods 获取这些分支,或者我需要以传统方式安装它们吗?
我尝试在 CocoaPods 网站上搜索这些分支是否已作为单独的 Pod 提交,但没有任何结果。我想知道是否有一种 Podfile 语法可以让你获得一个非主分支。
【问题讨论】:
标签:
cocoapods
alamofire
swift2
xcode7
swifty-json
【解决方案1】:
您可以在 Podfile 中指定存储库中的任何分支。
我用于 Alamofire 的示例:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift-2.0'
更改 Podfile 中的行,然后再次运行 pod install。
还有这种替代语法:
pod 'Alamofire', git: 'https://github.com/Alamofire/Alamofire.git', branch: 'swift-2.0'
【解决方案2】:
更新到当前答案。上面的行现在返回 git 错误,抱怨找不到 'swift-2.0' 分支。
请改用此表单:
pod 'Alamofire', '~> 2.0'