前言
前段時(shí)間cocopod配置總是出錯(cuò),用的少也不習(xí)慣击孩。打開(kāi)百度搜索出現(xiàn)的都是安裝和使用迫悠,鑒于已經(jīng)安裝了pod,所以直接自己總結(jié)一份為工程配置的筆記溯壶,以便以后使用及皂。
百度出來(lái)的教程思路和我不太一樣,看起來(lái)覺(jué)得別扭且改,還是自己弄一個(gè)验烧。
正文
1.打開(kāi)終端 ?cd到工程目錄
cd /Users/apple1/Desktop/Charles
2.創(chuàng)建Podfile
touch Podfile
3.使用vim編寫
vim Podfile
回車后如下:
3.2點(diǎn)擊i進(jìn)入編輯模式 ,如下:
3.3編輯完成點(diǎn)擊鍵盤上的esc又跛,再按“ :” 碍拆,輸入wq保存(英文鍵盤模式下) ?,回車退出。
例:這里兩句話的意思是當(dāng)前AFNetworking支持的最高版本是ios9.0感混,要下載的AFNetworking版本是2.1端幼。
4.有了Podfile以后,輸入以下命令安裝類庫(kù):
pod install
4.2完成后輸出信息如下:
192:Charles KRIS$ pod install
Updating local specs repositories
CocoaPods 1.0.1 is available.
To update use: `gem install cocoapods`
Until we reach version 1.0 the features of CocoaPods can and will change.
We strongly recommend that you use the latest version at all times.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (2.6.3)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `Charles.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
192:Charles KRIS$
表示已經(jīng)配置成功弧满,打開(kāi)工程你就會(huì)發(fā)現(xiàn)多了一個(gè)pod文件婆跑。
在工程配置了pod以后,打開(kāi)工程就變成了文件`Charles.xcworkspace` 庭呜。