今天在新項(xiàng)目中使用$ pod install
指令時撵儿,出現(xiàn)了[!] Oh no, an error occurred.報錯。
首先$ pod --version
查看CocoaPods的版本號狐血,發(fā)現(xiàn)版本比較低淀歇,打算升級CocoaPods試一下。
命令行更新步驟
$ sudo gem update --system // 更新gem
Password: // 輸入密碼匈织,等待更新完成
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
$ sudo gem install cocoapods // 安裝CocoaPods(時間稍長)
$ pod setup
當(dāng)我執(zhí)行$ pod setup
命令時浪默,又出現(xiàn)了一個錯誤。
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down
它給的信息是未能連接到github缀匕,后來發(fā)現(xiàn)是我的電腦科學(xué)上網(wǎng)后無法訪問github纳决,將科學(xué)上網(wǎng)工具關(guān)掉,重新$ pod setup
乡小,經(jīng)過漫長的等待几莽,終于提示了Setup completed
腺办。
Setup completed
然后重新執(zhí)行$ pod install
,發(fā)現(xiàn)又來了個新的錯誤信息
[!] Unable to find a specification for `AFNetworking`
然后在網(wǎng)上查到的解決方法晶框,重新安裝。(我是剛剛更新的啊兰英。??)
$ rm -rf ~/.cocoapods
$ pod setup
重新執(zhí)行$ pod install
,成功。
pod install