[!] CDN: trunk Repo update failed

冷暖自知 提交于 2020-02-25 23:56:05

环境

CocoaPods 1.8.4

Xcode 11.3

macOS 10.15.2

问题

pod install 安装库的时候出现了以下问题

[!] CDN: trunk Repo update failed - 3 error(s): CDN: trunk URL couldn’t be downloaded: 
https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/a/7/5/AFNetworking/1.0/AFNetworking.podspec.json, error: Failed to open TCP connection to raw.githubusercontent.com:443 (Connection refused - connect(2) for “raw.githubusercontent.com” port 443) CDN: trunk URL couldn’t be downloaded: 
https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/a/7/5/AFNetworking/2.6.0/AFNetworking.podspec.json, error: Failed to open TCP connection to raw.githubusercontent.com:443 (Connection refused - connect(2) for “raw.githubusercontent.com” port 443) CDN: trunk URL couldn’t be downloaded: 
https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/a/7/5/AFNetworking/3.2.0/AFNetworking.podspec.json, error: Failed to open TCP connection to raw.githubusercontent.com:443 (Connection refused - connect(2) for “raw.githubusercontent.com” port 443)

关于CDN的引入请看CocoaPods官方介绍:http://blog.cocoapods.org/CocoaPods-1.8.0-beta/

我的解决方案

第一步: Podfile 中添加 source 'https://github.com/CocoaPods/Specs.git'

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

platform:ios,'10.0'

#inhibit_all_warnings!
#use_frameworks!

target 'test' do

pod 'GWLCustomButton'

end

第二步: pod repo list 查看一下源列表,显示 cocoapods 和 trunk

第三步: pod repo remove trunk 移除 trunk 源,移除 trunk 源后只剩 cocoapods 源

cocoapods
- Type: git (master)
- URL:  https://github.com/CocoaPods/Specs.git
- Path: /Users/gwl/.cocoapods/repos/cocoapods

1 repo

第四步: 执行 pod install 安装,会显示:Cloning spec repo cocoapods from https://github.com/CocoaPods/Specs.git 信息,接下来就是漫长的等待,很漫长…,然后安装成功

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!