Cocoapods 的使用前服用
Mar 17, 2019
前往 terminal 輸入以下指令即可安裝 cocoapods
sudo gem install cocoapods
前往專案的根目錄,建立 Podfile 文件
pod init
生成後的 Podfile 長這樣
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'Demo' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Demo
end
接下來安裝你要的套件,這邊安裝 Moya 當範例
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0' -> SDK 最低版本需求
target 'Demo' do # 專案名稱
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Demo pod 'Moya' #套件路徑
end
輸入完後 :wq
儲存離開,然後在輸入以下指令開始安裝
pod install
接下來把 Xcode 關掉,打開 .xcworkspace 檔,而非 .xcodeproj 檔
指定的 framework 更新到最新版本
pod update Moya