更新cocoapods遇到error RPC failed; curl 56 SSLRead() return error -36

更新cocoapods遇到的问题

[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master

Cloning into’master’…

error: RPC failed; curl56SSLRead()returnerror -36

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

之前在网上找了很多方法,试了不少,已经没了头绪,印象中我的是顺序是,替换了gem sources,用的https://gems.ruby-china.org/这个,用淘宝那个失败,网上搜是不维护了。更新了gem,卸载cocoapods,安装,但是到pod setup的时候,失败,报上边那个错误。

更新gem,卸载cocoapods等操作,可以参考文章最下边的链接,这里不重复了。

然后尝试手动克隆Github上Spec到cocoapods/repos/路径下,失败。

把Github吧Spec下载下来,然后手动放到repos下,执行pod setup,失败,error没记录

最后找到一个方案

建议先看完,再操作

1、只有一个xcode的情况,打开终端,输入以下命令:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

2、多个xcode

《更新cocoapods遇到error RPC failed; curl 56 SSLRead() return error -36》

需要修改命令:

sudo xcode-select -switch /Applications/Xcode 7.3.1.app/Contents/Developer

根据你默认的xcode来修改在/Applications//Contents/Developer中间的app的名字,如果你默认的是Xcode x.x.x.app,中间就要替换掉。

也可以在终端里输入:

sudo xcode-select –print-path

输出:

/Applications/Xcode.app/Contents/Developer

这步结束。

然后删除repos目录下master

sudo rm -fr ~/.cocoapods/repos/master

再执行pod setup,等了一会,成功了。

打开用了pods的工程,执行pod update,报错

[!] The dependency `FMDB (~>2.3)`isnotusedinany concrete target.等等

网上找到答案,修改Podfile格式,下边的#是注释

platform:ios,’8.0′

#use_frameworks!个别需要用到它,比如reactiveCocoa

target ‘MyApp’ do

pod ‘AFNetworking’, ‘~> 2.6’

pod ‘ORStackView’, ‘~> 3.0’

pod ‘SwiftyJSON’, ‘~> 2.3’

end

修改完Podfile的格式,在执行pod update,记得要到Podfile所在的目录下

个人认为,正确的顺序就是

检查gem,更新到最新,现在是2.6.7

替换gem sources 为 https://gems.ruby-china.org/

然后按照上边的步骤开始执行就可以了。

祝好运,现在开始操作吧。

参考链接

CocoaPods最新安装和问题解决教程(干货) – 简书

    原文作者:Gentle_Boy
    原文地址: https://www.jianshu.com/p/ca3f366da8f1
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞