Getting non-master branch from Cocoapods?

早过忘川 提交于 2019-12-11 12:41:25

问题


I've been using SwiftyJSON and Alamofire in a project. Recently I downloaded XCode 7 beta. Both SwiftyJSON and Alamofire have separate, non-master branches for Swift 2. Is there a way to get these via CocoaPods, or do I need to install them in the traditional way?

I tried searching on the CocoaPods website to see if these branches had been submitted as separate Pods, but nothing came up. I'm wondering if there is a Podfile syntax that allows you to get a non-master branch.


回答1:


You can specify any branch from the repository in your Podfile.

Example I'm using for Alamofire:

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift-2.0'

Change the line(s) in your Podfile then run pod install again.


There's also this alternative syntax:

pod 'Alamofire', git: 'https://github.com/Alamofire/Alamofire.git', branch: 'swift-2.0'



回答2:


Update to the current answer. The line above now returns git errors complaining that the 'swift-2.0' branch is not found. Use this form instead:

pod 'Alamofire', '~> 2.0'


来源:https://stackoverflow.com/questions/31334205/getting-non-master-branch-from-cocoapods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!