1.CocoaPods的安装及使用:
 http://code4app.com/article/cocoapods-install-usage
 http://objccn.io/issue-6-4/
 http://www.jianshu.com/p/5fc15906c53a
 查看当前的源
 gem sources -l
 gem sources --remove https://rubygems.org/
 //等有反应之后再敲入以下命令,添加淘宝镜像
 gem sources -a https://ruby.taobao.org/
 只有在终端中出现下面文字才表明你上面的命令是成功的:
 *** CURRENT SOURCES ***
 https://ruby.taobao.org/
 这时候,你再次在终端中运行:
 --verbose参数表示显示指令的执行过程
 sudo gem install cocoapods --verbose
 //将 CocoaPods Specs repository复制到你电脑上~/.cocoapods目录下,
 它需要一点时间来完成,你等就是了
 pod setup
 如果安装失败 ~/.cocoapods 里面是空的,就需要重新setup
 命令如下:
 pod repo remove master  
 pod setup
 执行pod setup如果出现如下报错
 [!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --depth=1
 xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use `xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools (or see `man xcode-select`)
 则执行:
 sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
 如果Ruby环境不够新,可能需要更新以下:
 sudo gem update --system
 查看版本:
 pod --version
 搜索:
 pod search AFNetworking
 生成Podfile文件
 pod init
 Podfile文件示例:
 platform :ios, '6.0'
 target 'iOSDevTemplate' do
 pod 'AFNetworking'      //不显式指定依赖库版本,表示每次都获取最新版本
 pod 'AFNetworking',  ‘2.0’     //只使用2.0版本
 pod 'AFNetworking', ‘>2.0′     //使用高于2.0的版本
 pod 'AFNetworking', ‘>=2.0′     //使用大于或等于2.0的版本
 pod 'AFNetworking', ‘<2.0′     //使用小于2.0的版本
 pod 'AFNetworking', ‘<=2.0′     //使用小于或等于2.0的版本
 pod 'AFNetworking', ‘~>0.1.2′   //使用大于等于0.1.2但小于0.2的版本,相当于>=0.1.2并且<0.2.0
 pod ‘AFNetworking’, ‘~>0.1′     //使用大于等于0.1但小于1.0的版本
 pod ‘AFNetworking’, ‘~>0′     //高于0的版本,写这个限制和什么都不写是一个效果,都表示使用最新版本
 end
 下载开源库:
 pod install --no-repo-update --verbose
 更新开源库:
 pod update --no-repo-update --verbose
 更新本地索引库
 pod repo update --verbose