美文网首页
iOS CocoaPods

iOS CocoaPods

作者: 平原河流 | 来源:发表于2022-07-27 09:29 被阅读0次

官方地址:https://cocoapods.org

CocoaPods安装参考 https://www.jianshu.com/p/83b555915261

仓库repo

pod仓库
1、仓库目录
Finder -- 前往 -- 前往文件夹目录

~/.cocoapods/repos

2、查看仓库

pod repo list

3、删除仓库

pod repo remove xxx

CocoaPods1.8.0之后默认使用trunk作为master仓库。即当使用pod installpod update相关命令时,如果未制定仓库源,默认使用trunk仓库源。但trunk仓库源,经常失败。
可以删除当前master 仓库源,重新指定仓库源。以github上的CocoaPods为例:

git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master

克隆成功后,在Podfile中指定仓库源

source 'https://github.com/CocoaPods/Specs.git'

常见问题

有时候执行pod install --verbosepod update --verbose时,会遇到以下错误:

error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

解决办法
1、查看网络连接是否正常;
2、使用ping命令,查看是否能够连接域名或IP;

(base) LLdeiMac:~ ll$ ping github.com
PING github.com (140.82.112.3): 56 data bytes
64 bytes from 140.82.112.3: icmp_seq=0 ttl=48 time=268.836 ms
64 bytes from 140.82.112.3: icmp_seq=1 ttl=48 time=263.389 ms
64 bytes from 140.82.112.3: icmp_seq=2 ttl=48 time=258.871 ms

3、设置hosts
前往文件夹,输入以下路径,回车。找到hosts文件,复制出来,打开、修改、保存,再替换原目录下的hosts文件。

/etc/hosts

或使用vi命令直接编辑。

sudo vi  /etc/hosts

增加以下内容:

140.82.112.3    github.com

相关文章

网友评论

      本文标题:iOS CocoaPods

      本文链接:https://www.haomeiwen.com/subject/zdhgdktx.html