Cocoapad 安装 使用

来源:互联网 发布:淘宝买家投诉举证 编辑:程序博客网 时间:2024/06/07 06:28

CocoaPods is thedependency manager for Swift and Objective-C Cocoa projects. It has thousands of libraries and can help you scale your projects elegantly.

谢谢作者的教程: http://code4app.com/article/cocoapods-install-usage

1.首先自己的mac pro 默认安装了ruby

$ gem sources --remove https://rubygems.org///等有反应之后再敲入以下命令$ gem sources -a http://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***http://ruby.taobao.org/
$ sudo gem install cocoapods
也就是按照上面这几个步骤 cocoapods就安装好了。

2.测试下能不能用

pod search AFNetworking

ok等了很久之后,貌似是成功了





然后去https://github.com/AFNetworking/AFNetworking 查看AFNetworking installation with CocoaPods

安装步骤 :https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking

大致步骤是:现在项目目录下声称一个名为Podfile的配置文件,文件的内容是:
source 'https://github.com/CocoaPods/Specs.git'platform :ios, '7.0'pod 'AFNetworking', '~> 2.5'
然后同一目录下,T中 $pod install
执行之后的效果:



大致意思是安装好了,同时也初始化好了项目,以后从***.xcworspace打开项目,而不是****.xcodeproj
执行了以上的操作之后,项目的文件结构上有什么不同呢????上图



好 可以直接用AFNetwork了
0 0
原创粉丝点击