下载和安装CocoaPods
下面的命令依次进行
Command命令 | command meaning 命令功能 | exec results 执行结果 |
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1 | brew 即 Homebrew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件, 只需要一个命令 |
|
ruby -v | 查看ruby版本 | ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] |
gem -v | 查看gem版本 | 2.0.14 |
gem source -r https://rubygems.org/ | 移除 镜像https://rubygems.org/ | https://rubygems.org/ removed from sources |
gem source -a https://ruby.taobao.org | 添加淘宝镜像 | https://ruby.taobao.org added to sources |
gem sources -l | 验证Ruby镜像是并且仅是taobao | *** CURRENT SOURCES *** https://ruby.taobao.org |
sudo gem install cocoapods | 安装cocoapods | Successfully installed cocoapods-0.35.0 |
项目中使用Pods
命令功能 | command命令 | exec results执行结果 | file changes |
demo-新建项目DemoCocoa,进入根目录 |
|
|
|
创建Podfile文件 |
|
|
|
|
| Analyzing dependencies [!] From now on use `DemoCocoa.xcworkspace`. [!] [!] The Podfile does not contain any dependencies. |
|
编辑Podfile文件 | 在Podfile输入需要用到的类库例如: #Podfile文件内容 platform :ios, "6.0" 如果需要查看引用的类库是否支持CocoaPods。可以用CocoaPods的搜索功能验证一下。例如在终端中输入: pod search AFNetworking |
|
|
|
| Installing AFNetworking (2.5.0) [!] Error installing JSONKit |
在pods文件夹中增加了Podfile中指定的第三方文件 Headers里面是这些第三方文件的一个引用
|
Refs