看了这篇文章,记的笔记:
http://www.cocoachina.com/ios/20140107/7663.html
安装
sudo gem install cocoapods
可能会出现如下错误:(需要翻墙)
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/quick/Marshal.4.8/cocoapods-0.38.2.gemspec.rz)
或者,用淘宝的ruby镜像
gem sources --remove https: //rubygems.org/
gem sources -a http: //ruby.taobao.org/
使用
1. search, 从pod库中搜索
pod search JSONKit
搜索结果:
-> JSONKit (1.5pre)
A Very High Performance Objective-C JSON Library.
pod 'JSONKit', '~> 1.5pre'
- Homepage: https://github.com/johnezang/JSONKit
- Source: https://github.com/johnezang/JSONKit.git
- Versions: 1.5pre, 1.4 [master repo]
2. podfile, 加入自己的工程
在项目根目录下创建Podfile文件;
在Podfile文件中加入如下内容:
platform: ios, '7.0'
pod 'JSONKit', '~> 1.5pre’ //看上面搜索结果,第三行内容
如想添加多个,则顺次向下写。
3. install, 安装第三方库
pod install
打开 .xcworkspace 就可以使用第三方库了
4. update, 升级第三方库
pod update
本文介绍了如何使用CocoaPods管理iOS项目的依赖库,包括安装CocoaPods、解决安装过程中遇到的问题、搜索及添加第三方库到项目的方法。
2469

被折叠的 条评论
为什么被折叠?



