閑著沒事(卡卡卡卡)重做系統(tǒng),也為了使用最新的 Xcode版本,更新到最新的系統(tǒng)版本

image.png
1 安裝 CocoaPods
1.1 ruby 更新(Catalina 的 ruby 是 2.6.3 版本,不需要更新,1.1 這一步可以跳過)

ruby 版本
// 查詢r(jià)uby版本號(hào)
$ ruby -v
// 更新ruby
$ sudo gem update --system
1.2 ruby 更換鏡像
// 查詢當(dāng)前鏡像
$ gem sources -l
// 移除默認(rèn)鏡像
$ gem sources --remove https://rubygems.org/
// 添加國(guó)內(nèi)鏡像
$ gem sources -a https://gems.ruby-china.com/
2 安裝 CocoaPods (我安裝的版本是 1.9.1)
// 安裝 CocoaPods 命令
$ sudo gem install cocoapods
// CocoaPods 安裝完成后,繼續(xù)輸入命令
$ pod setup
- pod setup 很快就完成
CocoaPods 1.8 switches the CDN as the default spec repo source and comes with a few enhancements!
3 使用
3.1 官方 BLOG 說明,有個(gè)視頻很清楚
3.2 創(chuàng)建工程
// 添加 pod 支持,init
$ pod init
// 編輯 Podfile 之后,install
$ pod install

image.png
3.3 如果在 pod install 時(shí)提示
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/d/a/2/Alamofire/5.1.0/Alamofire.podspec.json Response: Couldn't connect to server
- 修改hosts
// 修改hosts
$ sudo vim /etc/hosts
// 在下面添加一行,保存退出
199.232.4.133 raw.githubusercontent.com

修改 hosts