xcode 使用 SwiftPackageManager 时报网络错误的解决方法

在使用 Swift 服务器框架 Vapor 时,因为用的是swiftPackageManager来管理依赖, xcode 打开项目后会自动拉取依赖,但是一直都拉取不成功,报如下错误:


截屏2021-06-07 上午9.34.02.png

在终端下使用xcodebuild -resolvePackageDependencies也不行,报同样的错误:

➜  hello git:(master) xcodebuild -resolvePackageDependencies
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies

Resolve Package Graph

Fetching https://github.com/vapor/vapor.git

Resolved source packages:
  hello: /Volumes/Work/vapor_project/hello

xcodebuild: error: Could not resolve package dependencies:
  An unknown error occurred. unexpected return value from ssl handshake -9806 (-1)

➜  hello git:(master) 

在查了各种资料后发现给xcodebuild再加个选项就可以成功解决此问题;

xcodebuild -resolvePackageDependencies -scmProvider system

终极方案-支持xcode

git config --global http.proxy http://proxy.example.com:8080
git config --global https.proxy http://proxy.example.com:8080
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容