升级 CocoaPods问题

一.遇到的问题

升级 CocoaPods 到 1.9.1 版本
但是随即问题就来了, 执行 pod install 下载库时,出现错误


报错.png

二.原因

在 Podfile 加上 source ‘https://github.com/CocoaPods/Specs.git’, 就是不用新版本的 CDN
[!] CDN: trunk Repo update failed
CocoaPods 1.8将CDN切换为默认的spec repo源,可能会抛出一下错误
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/a/7/5/AFNetworking/3.0.1/AFNetworking.podspec.json, error: Failed to open TCP connection to raw.githubusercontent.com:443 (Connection refused - connect(2) for "raw.githubusercontent.com" port 443)

三.解决方法

在 Podfile 加上 source ‘https://github.com/CocoaPods/Specs.git’, 就是不用新版本的 CDN
podfile文件中指定source源为master,执行pod repo remove trunk移除trunk源

四.举例

原本的 Podfile

target 'TestDemo' do
 use_frameworks!
 pod 'AFNetworking'
end

增加后的 Podfile

source 'https://github.com/CocoaPods/Specs.git'
target 'TestDemo' do
 use_frameworks!
 pod 'AFNetworking'
end

你可能感兴趣的:(升级 CocoaPods问题)