更新cocoapods遇到的問題
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master
Cloning into'master'...
error: RPC failed; curl56SSLRead()returnerror -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
之前在網上找了很多方法,試了不少,已經沒了頭緒,印象中我的是順序是,替換了gem sources,用的https://gems.ruby-china.org/這個,用淘寶那個失敗,網上搜是不維護了。更新了gem,卸載cocoapods,安裝,但是到pod setup的時候,失敗,報上邊那個錯誤。
更新gem,卸載cocoapods等操作,可以參考文章最下邊的鏈接,這里不重復了。
然后嘗試手動克隆Github上Spec到cocoapods/repos/路徑下,失敗。
把Github吧Spec下載下來,然后手動放到repos下,執行pod setup,失敗,error沒記錄
最后找到一個方案
建議先看完,再操作
1、只有一個xcode的情況,打開終端,輸入以下命令:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
2、多個xcode
需要修改命令:
sudo xcode-select -switch /Applications/Xcode 7.3.1.app/Contents/Developer
根據你默認的xcode來修改在/Applications/和/Contents/Developer中間的app的名字,如果你默認的是Xcode x.x.x.app,中間就要替換掉。
也可以在終端里輸入:
sudo xcode-select --print-path
輸出:
/Applications/Xcode.app/Contents/Developer
這步結束。
然后刪除repos目錄下master
sudo rm -fr ~/.cocoapods/repos/master
再執行pod setup,等了一會,成功了。
打開用了pods的工程,執行pod update,報錯
[!] The dependency `FMDB (~>2.3)`isnotusedinany concrete target.等等
網上找到答案,修改Podfile格式,下邊的#是注釋
platform:ios,'8.0'
#use_frameworks!個別需要用到它,比如reactiveCocoa
target 'MyApp' do
pod 'AFNetworking', '~> 2.6'
pod 'ORStackView', '~> 3.0'
pod 'SwiftyJSON', '~> 2.3'
end
修改完Podfile的格式,在執行pod update,記得要到Podfile所在的目錄下
個人認為,正確的順序就是
檢查gem,更新到最新,現在是2.6.7
替換gem sources 為 https://gems.ruby-china.org/
然后按照上邊的步驟開始執行就可以了。
祝好運,現在開始操作吧。
參考鏈接