CocoaPods是iOS最常用最有名的框架依赖管理工具。但是使用过程也是凭空的一波三折的,because I Love China。
首先你需要ruby环境。
$ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]安装CocoaPods?
$sudo gem install cocoapods中国程序员
得首先修改安装源:
$ gem sources --remove https://rubygems.org/
$ gem sources -add https://ruby.taobao.org/验证
$ gem sources -l只有出现如下文字,才说明以上命令成功
*** CURRENT SOURCES ***
http://ruby.taobao.org/执行pod install
$pod install出现Setting up CocoaPods master repo,说明Cocoapods在将它的信息下载到 ~/.cocoapods里;
需要下载800M左右完成。所以,这里需要等待。下载的内容就是pod的全部框架的每个版本的json文件集合。为什么这么做?这样做的话,本地(不需要服务器)就可得到所有依赖关系和对应的Pod下载地址了。
中国程序员
使用镜像,手动下载,初始化完成后执行一次
git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
pod repo update进入自己的工程,在Podfile内指定源头:
source 'https://git.coding.net/CocoaPods/Specs.git'执行安装:
pod installref
https://juejin.im/post/58fff191b123db260cba5c59在安装的时候,不去更新repo是很重要的,不然特别慢:
pod install --verbose --no-repo-update 要是报错:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining那么提升下buffer:
git config --global http.postBuffer 524288000然后打开workspace(注意不是xcproject)
open *.xcworkspace整篇文章好乱。fuck the GFW