安裝cocoapods遇到兩大坑-Ruby版本升級和Podfile的配置


今天安裝cocoapods

#移除原有ruby源
$ gem sources --remove https://rubygems.org/
#使用可用的淘寶網
$ gem sources -a https://ruby.taobao.org/
#檢查僅且只有一個ruby源
$ gem sources -l
#安裝cocoapods
$ sudo gem install cocoapods

報錯了:

是說Ruby版本過低,必須高於2.2.2.版本。所以

#查看自己電腦上的Ruby版本
$ ruby -v

是2.0.0.版本的,搜了一下需要升級Ruby。得益於http://blog.csdn.net/lissdy/article/details/9191351

#安裝RVM
$ curl -L get.rvm.io | bash -s stable
#檢測安裝是否正常
$ rvm -v
#查看當前ruby版本  
$ ruby -v  
#列出已知的ruby版本  
$ rvm list known  
#安裝ruby 2.3
$ rvm install 2.3  
#查看當前ruby版本  
$ ruby -v  

然而我安裝時出現了下面這種鬼東西,反正不是什么正常信息

搞了大半小時還是這樣,還多了一個錯誤!!!神奇的是還能安裝成功。。。。。。

之后就可以正常安裝cocoapods了。

#安裝 CocoaPods
$ sudo gem install cocoapods
$ pod setup

But 成功之后使用cocoapods導入第三方出錯:

Re-creating CocoaPods due to major version update.
Analyzing dependencies
[!] The dependency `AFNetworking (~> 3.0)` is not used in any concrete target.
The dependency `MBProgressHUD (~> 0.9.2)` is not used in any concrete target.
The dependency `MJRefresh` is not used in any concrete target.
The dependency `SDWebImage (~> 3.0)` is not used in any concrete target.
The dependency `Masonry` is not used in any concrete target.
The dependency `SVProgressHUD` is not used in any concrete target.
The dependency `JSONModel` is not used in any concrete target.
The dependency `CTAssetsPickerController (~> 3.3.2-alpha)` is not used in any concrete target.

原因是我安裝的cocoapods版本是  1.1.0.beta.1,所以podfile升級到最新版本后配置文件里面的內容必須明確所依賴的第三方的target

像上面這樣直接修改podfile的內容格式之后 pod install耐心等待就可以導入你想要的第三方

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM