第一步:更新gem
由于系统默认的更新源无法使用,所以需要移除,添加新的源,操作指令如下:
gem sources --remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
gem sources -l
sudo gem update --system
第二步:安装CocoaPods
sudo gem install cocoapods
pod setup
如果执行pod setup半天没反应,可以换下源地址:
pod repo remove master
pod repo add master https://gitcafe.com/akuandev/Specs.git
pod repo update
CocoaPods使用:
在项目根目录中新建Podfile文件,格式如下:
link_with'target1','target2' //给多个target进行链接头文件配置
source ' https://gitcafe.com/akuandev/Specs.git'
platform :ios,'7.0'
pod 'SVPullToRefresh'
pod 'MBProgressHUD'
执行pod install就会下载第三方库,每次更新Podfile文件之后,pod update就可以了
也可以通过CocoaPods插件来操作,可以通过Windown->Package Manager来安装此插件
参考文章地址:
http://blog.devtang.com/blog/2014/05/25/use-cocoapod-to-manage-ios-lib-dependency/