1.cocoaPods最新版本安装
由于 Podfilede的配置是在cocoaPods上完成的,因此我们需要先配置最新版本的cocoaPods
1.1 打开终端,移除现有的Ruby默认源
$gem sources --remove https://rubygems.org/
1.2 使用新的源
$gem sources -a https://ruby.taobao.org/
1.3 验证新源是否替换成功
$gem sources -l
1.4 安装CocoaPods
(1) $sudo gem install cocoapods 备注:苹果系统升级 OS X EL Capitan 后改为 $sudo gem install -n /usr/local/bin cocoapods
(2) $pod setup
1.5 更新gem
$sudo gem update --system
2.配置Podfile
2.1 Xcode新建工程,并在终端用cd+空格指令到文件夹内
cd cd /Users/a123/Desktop/wc_test
2.2 新建Podfile文件
vim Podfile
2.3 Podfile文件操作
文件创建好后,输入“i”进入编辑模式
platform :ios, '7.0'
target 'HouseNice' do
pod "AFNetworking","~>2.0"
end
输入完摁esc退出编辑模式,接下来输入“:wq”保存
!!!需要特别注意的是:iOS10后Podfile文件配置需在第二行以及末尾加上target 'HouseNice' do和end,否则就会报错!
2.4 最后一步
输入pod install ,然后静静地等待吧。配置完成后会提示
Analyzing dependencies
Downloading dependencies
Installing Masonry (1.0.1)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `1.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
123deMacBook-Pro:1 a123$
2.5 cocoapods安装过程中的可能会遇到一些问题,比如有关rvm版本的升级,以及ruby源的一些问题,这些在下面的链接中都有非常详细的解决办法
源自”AZZ的博客“
http://blog.csdn.net/xieyupeng520/article/details/50443909
源自“—君少”
http://www.cnblogs.com/guanshenbao/p/5534578.html












网友评论