前言
前段时间cocopod配置总是出错,用的少也不习惯。打开百度搜索出现的都是安装和使用,鉴于已经安装了pod,所以直接自己总结一份为工程配置的笔记,以便以后使用。
百度出来的教程思路和我不太一样,看起来觉得别扭,还是自己弄一个。
正文
1.打开终端 cd到工程目录
cd /Users/apple1/Desktop/Charles
2.创建Podfile
touch Podfile
3.使用vim编写
vim Podfile
回车后如下:

3.2点击i进入编辑模式 ,如下:

3.3编辑完成点击键盘上的esc,再按“ :” ,输入wq保存(英文键盘模式下) ,回车退出。
例:这里两句话的意思是当前AFNetworking支持的最高版本是ios9.0,要下载的AFNetworking版本是2.1。

4.有了Podfile以后,输入以下命令安装类库:
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$
表示已经配置成功,打开工程你就会发现多了一个pod文件。
在工程配置了pod以后,打开工程就变成了文件`Charles.xcworkspace` 。