老是會(huì)忘醋界,畢竟不會(huì)頻繁新建項(xiàng)目。以前怎么弄得也忘得差不多了膳帕,曾經(jīng)有段時(shí)間習(xí)慣使用Xcode的CocoaPods插件來(lái)安裝粘捎,后來(lái)Xcode不支持插件了,就用終端來(lái)安裝危彩,代碼這種東西攒磨,學(xué)而不時(shí)習(xí)之,就是會(huì)忘恬砂。
1. 新建工程 PodTest
2. 打開(kāi)終端咧纠,cd到 PodTest 根目錄
3. 在終端輸入 "pod init",會(huì)自動(dòng)創(chuàng)建一個(gè)名為 Podfile 的文件
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'PosTest' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for PosTest
target 'PosTestTests' do
inherit! :search_paths
# Pods for testing
end
target 'PosTestUITests' do
inherit! :search_paths
# Pods for testing
end
end
4. 編輯 Podfile 文件
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'PosTest' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for PosTest
pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
target 'PosTestTests' do
inherit! :search_paths
# Pods for testing
end
target 'PosTestUITests' do
inherit! :search_paths
# Pods for testing
end
end
5. 在終端輸入 "pod install"泻骤,等待下載完成漆羔。
pod install
6. 回到工程目錄,雙擊“PosTest.xcworkspace”進(jìn)入程序
以下是整個(gè)終端輸入的代碼:
WinsondeMacBook-Pro:~ Winson_microlink$ cd /Users/Winson_microlink/Documents/Xcode\ Projects/PosTest
WinsondeMacBook-Pro:PosTest Winson_microlink$ pod init
WinsondeMacBook-Pro:PosTest Winson_microlink$ pod install
Analyzing dependencies
Pre-downloading: `SVProgressHUD` from `https://github.com/SVProgressHUD/SVProgressHUD.git`
Downloading dependencies
Installing SVProgressHUD (2.2.2)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `PosTest.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] Automatically assigning platform ios with version 11.0 on target PosTest because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
WinsondeMacBook-Pro:PosTest Winson_microlink$