CocoaPods 是一個(gè) Cocoa 和 Cocoa Touch 框架的依賴(lài)管理器,具體原理和 Homebrew 有點(diǎn)類(lèi)似,都是從 GitHub 下載索引钞馁,然后根據(jù)索引下載依賴(lài)的源代碼。
對(duì)于舊版的 CocoaPods(1.3以前) 可以使用如下方法使用 tuna 的鏡像:
$ pod repo remove master
$ pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
$ pod repo update
新版的 CocoaPods (1.3以后)不允許用pod repo add
直接添加master庫(kù)了匿刮,但是依然可以:
$ cd ~/.cocoapods/repos
$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
最后進(jìn)入自己的工程僧凰,在自己工程的podFile第一行加上:
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'