1.安裝
1、環境配置
$ gem sources --remove
//等有反應之後再敲入以下命令
$ gem sources -a
//檢視是否成功
$ gem sources -l
2、安裝cocoapods
$ sudo gem install cocoapods
2、使用
pod init //生成podfile檔案,在檔案裡面寫
//pod 'svprogresshud'
//pod 'afnetworking', '~> 2.5.4'
pod install //生成的檔案放在了podfile所在的目錄.
pod update // 更新
pod search //查詢某個類庫
//更新使用以下命令可以提公升速度
pod install --verbose --no-repo
-update
pod update --verbose --no-repo
-update
3.podfile
3.1. pod 『objection』』version』;
例如,pod 『mcdateextensions』,不指定版本,在pod update時會獲取最新的版本;pod 『mcdateextensions』』~>1.0.0』,獲取的版本資訊是[1.0.0, 1.1.0). ~>是參照ruby的語法的,~>x.y.z, 的意思是版本號 x,y 固定,但可以大於等於 z。通常版本號的命名有其慣例:x major 版本號公升級表示有 api 發生不向後的相容性變動,y minor 版本號公升級表示有功能新增,z tiny 版本號公升級表示 bugs 修正。因此 「~> x.y.z」 可以讓我們保有公升級彈性,又不致於公升級太多讓程式發生不相容錯誤;
3.2. 從本地pod files, pod 'afnetworking', :path => '~/documents/afnetworking''
此目錄下一定要有.podspec文件
3.3. 從git server端pod files
to use the master branch of the repo:
pod 'afnetworking', :git=>
'', :branch=> 『develop』
or specify a commit:
pod 'afnetworking', :git=>
'', :commit=>
'082f8319af'
安裝和使用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 原因是 ...