最近換了一臺新mac,自然要重新裝一下cocoapods啦。但是,噩夢從此開始了,各種問題都遇到了。下面總結一下今天遇到的一些奇葩問題。推薦一下這篇文章
1.ruby源問題
ruby的默認軟件源在亞馬遜服務器上,地址是https://rubygems.org/ 但是這個是用不了的,所以我們需要換源
目前國內絕大多數(shù)用的是淘寶的鏡像:https://ruby.taobao.org/ (很多老教程中使用的是http://ruby.taobao.org/)。
1.sudo gem sources -r https://rubygems/org/
2.sudo gem sources -a https://ruby.taobao.org/
此時出現(xiàn)了:
Error fetching https://ruby.taobao.org/:SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://ruby.taobao.org/specs.4.8.gz)
目前找到的解決辦法有這幾個。
1.換個鏡像唄:http://gems.ruby-china.org/
這個問題的根本原因是ca-bunle中沒有包含GlobalSign根證書導致的。目前淘寶提供的解決辦法有兩個
2.升級ruby gems到2.6.3版本(該版本把GlobalSign加入到了gem的證書鏈中)
3.更新OpenSSL的ca-bundle到最新
更詳細的解釋請看github上的Issues
2.Setting up Cocoapods master repo問題
不得不說這個問題真的很讓人頭疼。當然問題也可以通過使用鏡像索引的方法解決
$ pod repo remove master
$ pod repo add master xxxx(鏡像地址)
$ pod repo update
但是更換了鏡像之后Podfile里面的source也得跟著改變,所以還是慢慢等吧。
3.Setting up Cocoapods master repo 下載過程中報錯:
error: RPC failed; result=56, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
這個問題主要是因為需要clone的東西太大了,超出了git的限制,所以我們需要手動調整一下git的配置,網(wǎng)上提供的命令是:
git config http.postBuffer 524288000
但是實際使用的時候變成下面的命令會更好用哦
git config --global http.postBuffer 524288000
4.還是Setting up Cocoapods master repo 過程中報的錯
error: RPC failed; curl 56 SSLRead() return error -36或者9806
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
解決方案:
$sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
-switch后面的地址代表的是Xcode包內容中的Contents文件夾下的Developer文件夾路徑