1. CocoaPods的安裝
1.1 安裝RVM
$ curl -L?get.rvm.io?| bash -s stable
1.2 測試是否正常安裝
$ source ~/.bashrc
$ source ~/.bash_profile?
$ rvm -v
1.3 安裝Ruby
$ ruby -v
$ rvm list known
$ rvm install 2.3.3
1.4 如果出現(xiàn)錯(cuò)誤則執(zhí)行下條語句
$ brew update && brew install gmp
1.5 安裝CocoaPods
$ gem install cocoapods
$ gem update --system
$ gem -v # 2.6.10
1.6 修改Pod源
$ gem sources --add?https://gems.ruby-china.org/?--remove?https://rubygems.org/
$ gem sources -l #?https://gems.ruby-china.org?確保只有?gems.ruby-china.org
1.7 最后一步
$ pod setup
2.CocoaPods的使用
2.1 創(chuàng)建Podfile
進(jìn)入工程目錄
$ pod init
會(huì)生成這樣一個(gè)文件
# Uncomment this line to define a global platform for your project
target 'YourProjectName' do
# platform :ios, '8.0'
#? ? Uncomment this line if you're using Swift or would like to use dynamic frameworks
#? ? use_frameworks!
#? ? Pods for YourProjectName
end
2.2 第三方庫的安裝與更新
終端執(zhí)行
$ pod install # 不會(huì)更新本地倉庫
$ pod update?
$ pod repo update # 更新本地倉庫
2.3 屏蔽第三方庫里的警告
在Podfile里加入 inhibit_all_warnings!
e.g.
# Uncomment this line to define a global platform for your project
target 'YourProjectName' do
platform :ios, '8.0'
inhibit_all_warnings!
#? ? Uncomment this line if you're using Swift or would like to use dynamic frameworks
#? ? use_frameworks!
#? ? Pods for YourProjectName
pod 'AWERatingBar', '~> 0.1.0'?
end
3.CocoaPods的卸載
# ? gem uninstall cocoapods