使用CocoaPods给项目配置第三方框架

1、创建Podfile文件

cd到工程目录,然后创建Podfile并且用vim编写

mac-3:~ ybd$ cd /Users/ybd/Desktop/huisheng  

mac-3:huisheng ybd$ touch Podfile  (创建Podfile)

2、输入vim Podfile 就会进入编辑页面,但是还不可以编辑

mac-3:huisheng ybd$ vim Podfile

3、键盘输入i 进入编辑模式


使用CocoaPods给项目配置第三方框架


(现在使用:MyApp 替换成自己的项目名)

target 'huisheng' do *********‘huisheng’换成自己的项目名

pod 'AFNetworking', '~> 2.1.0'

pod 'JSONKit-NoWarning', '~> 1.1'

pod 'MBProgressHUD', '~> 0.8'

end

4、编辑完后,然后按Esc,并且输入“ :”号进入vim命令模式,然后在冒号后边输入wq


使用CocoaPods给项目配置第三方框架

使用CocoaPods给项目配置第三方框架

5、在输入 pod install 就会给你的项目配置你想要的第三方框架

注意:现在打开项目不是点击 huisheng.xodeproj了,而是点击 huisheng.xcworkspace

****注意****为了确定AFNetworking是否支持CocoaPods,可以用CocoaPods的搜索功能验证一下。在终端中输入:

pod search AFNetworking