iOS pod install失败,提示CocoaPods could not find compatible versions for pod “***“

1.pod install失败

在执行pod install的时候会失败,提示如下:

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

None of your spec sources contain a spec satisfying the dependency: `MJRefresh (~> 3.5.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

按提示执行pod install --repo-update之后,还是失败,提示:

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

None of your spec sources contain a spec satisfying the dependency: `MJRefresh (~> 3.5.0)`.

You have either:
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

造成报错的原因有两种:

  • 一、两者的都是由于本地索引库没有更新到最新,找不到对应版本的spec文件。

  • 二、第三方库依赖的系统版本号,高于项目的最低支持版本,要解决只能升级最低支持的版本或者不升级第三方库。这就是为什么pod search成功,但pod install的原因,当然也有可能是某个第三方库也依赖了这个库,不过我记得报错不是这样的,会提示某个库依赖这个库的某个版本。

第一种按如下方法执行:

// 以本地master的实际目录为准:
cd ~/.cocoapods/repos/master
Git pull

执行完这两个命令之后,再执行pod install即可,参考

不过以上方法可能比较耗时,并且下载了很长时间也会失败,这里推荐你使用第三步中的方法,方便不耗时!

2.cocoapods升级

执行:

sudo gem install cocoapods
sudo gem install -n /usr/local/bin cocoapods

3.SSL_ERROR_SYSCALL

提示:

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

主要是cocoapods下载spec文件的速度太慢,个人喜欢到下面的地址直接下载,即Podfile文件的引入源。

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

解压完成之后将文件命名为master, 然后打开~/.cocoapods/repos/删除repos文件下的master,将我们下载的master文件替换进来,打开终端执行:

pod setup

完成之后,就可以正常执行pod install操作了。类似下面的报错也可以解决:

fatal: unable to access 'https://github.com/hackiftekhar/IQKeyboardManager.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

以上方法也可以解决类似4435654的问题,如果不能解决参考Pod\Ruby更新提示443

4.日常更新

最近发现还是会有443这类的问题出现,之前都能pod install下来的库,现在升级确不行(个别库,因为新增的能install下来),一直失败报错,有说需要清除本地代理配置:

取消代理

git config --global --unset http.proxy
git config --global --unset https.proxy

之后执行pod install,正常执行,由于升级的库较多,只成功了一次,之后又试了一次pod install,全部更新完毕!

这里有一点问题,因为本地的配置并没有设置过代理,感觉和这个关系也不大。从实际情况来看多执行几次pod install就可以了,并不需要做额外的操作

猜你喜欢

转载自blog.csdn.net/king6188/article/details/131314748
pod