Cocoapods1.8版本及重装之后Pod install问题(2020.6更新)

此篇文章主要讲解Cocoapods的更新,导致pod install一推错误,令人非常的不乐意,那么以下分析了会遇到的问题,因为网上的很多都是之前老旧的文档,我这经历一整天的滚打摸爬,总算能够顺利导入第三方库到项目了。

一.pod install更新的时候遇到的这个问题:

Traceback (most recent call last):
	2: from /usr/local/bin/pod:23:in `<main>'
	1: from /Library/Ruby/Site/2.6.0/rubygems.rb:296:in `activate_bin_path'
/Library/Ruby/Site/2.6.0/rubygems.rb:277:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)

解决办法:
1.# sudo gem update --system,再输入您的电脑密码.
在这里插入图片描述
2.如果pod版本不是最新版本,则更新pod

#pod --version
# sudo gem install -n /usr/local/bin sass
#sudo gem install -n /usr/local/bin cocoapods

如果还是出现框架版本不是最新版本,更新Pod缓存重新初始化

# rm -fr ~/.cocoapods/repos/master
# pod setup

3.gem install cocoapods

二:gem install cocoapods时遇到如下问题:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

解决办法:
改为:# sudo gem install -n /usr/local/bin cocoapods
在这里插入图片描述
三:史上最坑的就这个,Pod install之后一直卡住,其实只是网络的原因导致源下载的太慢,因此各位不要心急!等等等~~(见图2)我用的是内网,配置的source ‘https://github.com/CocoaPods/Specs.git’(图1),
在这里插入图片描述
图2:这个会卡的您怀疑人生,我当时搞了一整天,当初还以为这命令不行,反复的关闭了好多次。
在这里插入图片描述
通过查看MAC活动监听器,看网络里是否在运行下载当前cocoapods数据,只要显示有git-remote-https就代表在运行,只是很慢,如下图:
在这里插入图片描述

四:pod install之后cocoapods1.8版本后需要使用CDN服务,报错如图:

在这里插入图片描述

解决办法:
1.podfile添加source ‘https://github.com/CocoaPods/Specs.git’
在这里插入图片描述
2.pod repo list 查看一下源列表
在这里插入图片描述
3.pod repo remove trunk 移除trunk源
在这里插入图片描述

五:pod search afnetworking遇到的问题

[!] Unable to find a pod with name, author, summary, or description matching `wechatopensdk`

解决办法:
1.pod search
2.pod repo remove master
3.cd ~/.cocoapods/repos
4.git clone --depth 1 https://github.com/CocoaPods/Specs.git master(这个就直接把master-specs源下载到本地了,我下载了一个多小时)
在这里插入图片描述
5.~/Library/Caches/CocoaPods/search_index.json
6.pod search afnetworking(等待大约两分钟)
在这里插入图片描述
此时可以进行cocoapods搜索到第三方框架了。

六:pod install可以搜索到第三方框架,但当前的target版本(platform:ios,‘9.0’)不匹配!

[!] CocoaPods could not find compatible versions for pod "SnapKit":
  In Podfile:
    SnapKit (~> 5.0.0)

Specs satisfying the `SnapKit (~> 5.0.0)` dependency were found, but they required a higher minimum deployment target.

在这里插入图片描述

解决办法:
1.提高当前target版本(platform:ios,‘10.0’)
2.使用匹配当前target版本(platform:ios,‘9.0’)的SnapKit版本!
3.使用podsearch SnapKit 查看可用版本或者去SnapKit主页挑选匹配版本

我使用5.0.0,必须得10.0才可以,因此你们根据自己导入的需求install.

修改如下:
在这里插入图片描述

最终:不容易啊这特么cocoapods坑的慌。
在这里插入图片描述

Cocoapods1.8版本以及重装Cocoapods的一切问题得到解决,在此已详细讲解,如果有伙伴遇到这样的难题,欢迎留言咨询!

Cocoapods的使用的导入项目:

1.cd ~(项目文件夹)
2.pod init (此时会多一个podfile文件)
在这里插入图片描述
3.进入podfile文件,编写需要导入的第三方
在这里插入图片描述
4.pod install

5.大功告成!!~ 如果觉得可以记得收藏和关注,谢谢!会不断的更新…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值