在使用 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