安装教程:http://www.th7.cn/Program/Ruby/201507/513274.shtml跟http://code4app.com/article/cocoapods-install-usage,http://www.cnblogs.com/i-am-lvjiazhen/p/6148703.html这两个博客的教程很全面很具体,但是需要注意的一点事在重新设置镜像的时候需要用到的是https而不是http这一一定要注意否则安装不上,在第一次使用cocoapods时输入pod install命令后会出现Setting up CocoaPods master repo这个提示,需要卡很久,在第一个博客中有详细说明原因,然后你会发现会出现如下图报的错误

这里需要修改Podfile文件内容为
platform :ios, ‘7.0‘
target "RWTFlickrSearch" do
pod ‘ReactiveCocoa‘, ‘2.1.8‘
pod ‘objectiveflickr‘, ‘2.0.4‘
pod ‘LinqToObjectiveC‘, ‘2.0.0‘
pod ‘SDWebImage‘, ‘3.6‘
end
增加podfile的目标即所在的项目名字就可以了
在一系列安装下载之后,你还会惊奇的发现你下载的三方库竟然不能再工程里导入头文件(崩溃吧!!!),这时你需要在原工程里修改一下设置,具体做法如下
选择targets

选择build settings

搜索User Header Search Paths

增加如下字段

后面的一定要选择recersive
(可以在target-Build Settings下修改“User Header Search Paths”项,新增${SRCROOT}并选择rcursive)
然后就可以使用cocoapods了
补充:
1.在执行pod setup时实际上是在下载安装第三方库的索引目录,因此我们可以直接从githups上下载索引目录拷进repos文件夹。
前往https://github.com/CocoaPods/Specs,下载该索引,然后拷进repos文件夹。目录结构如下图所示:

2.
cd ~/.cocoapods/repos
git clone https://github.com/CocoaPods/Specs.git


下载完成之后需要把这个Specs 改名为master
再执行pod repo
master
- Type: git (master)
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/fengsh/.cocoapods/repos/master
1 repo
就可以了
网友评论