今天在安裝cocoapods的時候出現的情況:
首先安裝cocoapods執行命令列:sudo gem install cocoapods
會出現這個錯誤:
error: could not find a valid gem 'cocoapods' (>= 0), here is why:
unable to download data from
- errno::econnrefused: connection refused - connect(2) (quick/marshal.4
.8/cocoapods-0.37
.1.gemspec.rz)
error: possible alternatives: cocoapods
這是因為service被牆了,要換乙個sources:
gem sources --remove
gem sources -a
gem sources -l
如果列印出來的東西是:
.org
那麼再執行安裝cocoapods命令:
sudo gem install cocoapods
然後你就會看到安裝程序了,那麼接下來就恭喜你完成了!!!
接下來新建乙個專案qzproject
$ cd ******
******為專案目錄,直接將專案拖到終端就行
新建podfile檔案
$ vim podfile
輸入i進入編輯狀態,目前高版本podfie這樣編寫
$
platform: ios,'8.0'
$ target 'qzproject'
do$ pod 'sdautolayout'
$ end
完成後敲esc然後:wq(儲存並退出)
最後
$ pod install
完成
當遇到一下問題時:
可以這樣解決:
在podfile檔案中加上:
use_frameworks
!
即可!!!
持續更新
安裝和使用cocoaPods
一 cocoapods是什麼?在ios開發中,我們一定會經常使用到各種各樣的第三方開源庫,使用這些開源庫的時候,需要引入原始碼 進行設定 引入其他framework,還有版本的更新.這些工作沒有技術含量而且複雜。這個時候,你要是用了cocoapods,只需要將用到的第三方開源庫放到乙個名為podfi...
CocoaPods安裝和使用
cocoapods安裝和使用 1 需要在本地安裝ruby環境 在終端中輸入 sudo geminstall cocoapods 如果被牆則輸入 gemsources remove gemsources a 檢視是否成功 gemsources l 出現以下則成功 current sources 接著輸...
cocoaPods安裝和使用
1.檢查ruby預設源的映象 沒有改過是cocoapods.org gem sources l 2.移除原有的,映象換成 的 sudo gem sources r sudo gem sources a 報錯 error fetching bad response not found 404 原因是 ...