CocoaPods 的安装与基本使用方法

来源:互联网 发布:js 界面跳转 编辑:程序博客网 时间:2024/05/19 18:12
看了这篇文章,记的笔记: 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




0 0
原创粉丝点击