参考资料:
http://blog.csdn.net/doublefi123/article/details/38238599
http://blog.csdn.net/ysy441088327/article/details/8611731
1/ 安装
如果没有ruby环境,可以通过淘宝的ruby镜像环境去下载
CocoaPods是用Ruby写的,所以运行需要安装Ruby环境。Mac中已经自带Ruby环境,这个不用我们担心,如果认为Ruby环境不够新,我们可以先更新,打开终端,输入以下命令:
gem update –system
在命令行依次输入 :
gem sources –remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
sudo gem install cocoapods
如果本地有ruby环境 直接输入第三条命令
显示这样的:
。。。。。。
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-0.38.2
Installing ri documentation for cocoapods-0.38.2
20 gems installed
2/ 使用
(1)使用cocoapods 在项目中导入 AFNetworking类库
可以用CocoaPods的搜索功能验证一下。在终端中输入:
pod search AFNetworking
过几秒钟之后,你会在终端中看到关于AFNetworking类库的一些信息