1.CocoaPods的安裝及使用:
http://code4app.com/article/cocoapods-install-usage
http://objccn.io/issue-6-4/
http://www.jianshu.com/p/5fc15906c53a
查看當前的源
gem?sources?-l
gem?sources?--remove?https://rubygems.org/
//等有反應之后再敲入以下命令,添加淘寶鏡像
gem?sources?-a?https://ruby.taobao.org/
只有在終端中出現下面文字才表明你上面的命令是成功的:
***?CURRENT?SOURCES?***
https://ruby.taobao.org/
這時候,你再次在終端中運行:
--verbose參數表示顯示指令的執行過程
sudo?gem?install?cocoapods?--verbose
//將?CocoaPods?Specs?repository復制到你電腦上~/.cocoapods目錄下,
它需要一點時間來完成,你等就是了
pod?setup
如果安裝失敗?~/.cocoapods?里面是空的,就需要重新setup
命令如下:
pod?repo?remove?master??
pod?setup
執行pod?setup如果出現如下報錯
[!]?/usr/bin/git?clone?https://github.com/CocoaPods/Specs.git?master?--depth=1
xcrun:?error:?active?developer?path?("/Volumes/Xcode/Xcode.app/Contents/Developer")?does?not?exist,?use?`xcode-select?--switch?path/to/Xcode.app`?to?specify?the?Xcode?that?you?wish?to?use?for?command?line?developer?tools?(or?see?`man?xcode-select`)
則執行:
sudo?xcode-select?-switch?/Applications/Xcode.app/Contents/Developer
如果Ruby環境不夠新,可能需要更新以下:
sudo?gem?update?--system
查看版本:
pod?--version
搜索:
pod?search?AFNetworking
生成Podfile文件
pod?init
Podfile文件示例:
platform?:ios,?'6.0'
target?'iOSDevTemplate'?do
pod?'AFNetworking'??????//不顯式指定依賴庫版本,表示每次都獲取最新版本
pod?'AFNetworking',??‘2.0’?????//只使用2.0版本
pod?'AFNetworking',?‘>2.0′?????//使用高于2.0的版本
pod?'AFNetworking',?‘>=2.0′?????//使用大于或等于2.0的版本
pod?'AFNetworking',?‘<2.0′?????//使用小于2.0的版本
pod?'AFNetworking',?‘<=2.0′?????//使用小于或等于2.0的版本
pod?'AFNetworking',?‘~>0.1.2′???//使用大于等于0.1.2但小于0.2的版本,相當于>=0.1.2并且<0.2.0
pod?‘AFNetworking’,?‘~>0.1′?????//使用大于等于0.1但小于1.0的版本
pod?‘AFNetworking’,?‘~>0′?????//高于0的版本,寫這個限制和什么都不寫是一個效果,都表示使用最新版本
end
下載開源庫:
pod?install?--no-repo-update?--verbose
更新開源庫:
pod?update?--no-repo-update?--verbose
更新本地索引庫
pod?repo?update?--verbose