1叭首,如何在項(xiàng)目中創(chuàng)建
cd到項(xiàng)目,然后touch Podfile在項(xiàng)目中創(chuàng)建一個(gè)podfile文件
2.添加第三方庫(kù)
platform :ios, '8.0'
target 'demo' do
pod 'Masonry'
? ? pod 'SDWebImage', '~> 4.2.3'
end
3.pod update 安裝
二:pod升級(jí)及其他使用
2.1信峻,先更新gem,再終端輸入gem update --system
如果這個(gè)不行可能是權(quán)限問(wèn)題瓮床,換成sudo gem update --system
2.2 切換源
查看源是gem sources -l
添加源gem sources -a http://gems.rudy-china.com/
2.3 安裝 gem install cocoa pods
OS X 10.11以后系統(tǒng)的安裝cocoapods 指令:$ sudo gem install -n /usr/local/bin cocoapods
2.4 安裝成功之后進(jìn)行 pod setup
2.5 進(jìn)行pod search 搜索盹舞,就可以了
如果沒有搜索成功,可以先刪除pod文件
cd ~/.cocoapods/
?sudo -rm -rf ~/.cocoapods/
再pod setup
如果還是出現(xiàn)error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 錯(cuò)誤
我們可以使用下面的方式:
?git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
https://git.coding.net/CocoaPods/Specs.git 目前已經(jīng)不更新了隘庄,可以使用https://code.aliyun.com/Magi/CocoaPods.git?或者h(yuǎn)ttps://github.com/CocoaPods/Specs.git(推薦)
三 其他相關(guān)命令
pod repo 查看master源
添加master源:pod ?repo add master https://.......
刪除master源: pod repo remove master https://.........