检查 CocoaPods 版本```shell

pod —version

  1. 更新镜像地址
  2. <a name="4j045"></a>
  3. ### CocoaPods 版本 < 1.9
  4. ```shell
  5. pod repo remove master // 移除master源
  6. pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git // 添加清华源
  7. pod repo update // 更新资源库

CocoaPods 版本 >= 1.9

  1. cd ~/.cocoapods/repos // 进入pods资源库
  2. pod repo remove master // 移除master源
  3. git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master // 克隆清华源

项目指定源

最后进入自己的工程,在自己工程的Podfile 第一行加上:

  1. //==> ios/Podfile
  2. source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

语雀内容