CocoaPods安装教程:
1、打开终端查看自己的 ruby 环境
$gem sources -l
如果是https://rubygems.org/
,进行移除(因为需要翻墙,又不会翻),所以替换成咱们自己家的ruby 环境。操作如下:
$gem sources --remove https://rubygems.org/
2、增加咱们自己家的ruby环境:
$gem sources -a https://ruby.taobao.org/
或
$gem source -a https://gems.ruby-china.org
如果碰到下面问题:
Error fetching https://gems.ruby-china.org: bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
或者:
ERROR: SSL verification error at depth 0: ok (0) Error fetching https://ruby.taobao.org/: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (certificate rejected) (https://ruby.taobao.org/specs.4.8.gz)
则使用下面一个增加命令:
$gem sources --add https://gems.ruby-china.com/
看到终端显示:https://gems.ruby-china.com/ added to sources
就成功啦!输入gem sources -l
看看:
*** CURRENT SOURCES ***
https://gems.ruby-china.com/
OK~
3、安装CocoaPods
$sudo gem install -n /usr/local/bin cocoapods --pre
输入密码:

输好直接回车就等着就好啦
安装第三方库
1、$cd 项目目录
到当前目录下:
cd 你的工程目录
2、vim Podfile
新建一个Podfile,用于引入第三方库的添加(i输入状态,:wq保存退出 :q退出)
3、$pod install
4、

网友评论