2017年cocoaPods 1.2.1升级

还在用老版本的ccoaPods,安装三方库时,会报错 :html




因此得升级cocoaPods到1.2.1最新版

安装源:[!] Invalid `Podfile` file: [!] The specification of `link_with` in the Podfile is now unsupported, please use target blocks instead..

一、查看ruby源ios

gem sources -lgit

 

二、移除掉原有的源github

gem sources --remove https://rubygems.org/数组

 

三、添加国内最新的源。ruby-chinaruby

gem sources -a https://gems.ruby-china.orgspa

 

四、检查是否添加成功code

gem sources -lorm

五、安装cocoapodshtm

sudo gem install -n /usr/local/bin cocoapods

 

六、安装完成后查看pod版本

pod --version

 

七、更新Podspec索引文件,建立本地索引库(这里要多等一下子)

pod setup

 

八、进入项目目录

cd ~

 

9.建立Podfile文件 (编写Podfile文件也是一个注意点,主要一点是项目有多个target)

  状况一:多个target公用相同库,还能够添加额外的不一样第三方库.




状况二:当项目只有一个target# -*- coding: UTF-8 -*- source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # ruby语法 # target数组 若是有新的target直接加入该数组 targetsArray = ['targetName1', 'targetName2', 'targetName3', 'targetName4', 'targetName5'] # 循环 targetsArray.each do |t| target t do pod 'MJRefresh', '~> 1.4.6' pod 'Masonry', '~> 0.6.1' end end
source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' target 'targetName1' do pod 'MJRefresh', '~> 1.4.6' pod 'Masonry', '~> 0.6.1' end

状况三:不一样target依赖库




参考来自:source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' target 'targetName1' do pod 'MJRefresh', '~> 1.4.6' pod 'Masonry', '~> 0.6.1' end target 'targetName2' do pod 'MJRefresh', '~> 1.4.6' pod 'Masonry', '~> 0.6.1' pod 'AFNetworking', '~> 3.0' end

http://www.cnblogs.com/Crazy-D/p/6421611.html http://www.jianshu.com/p/5d29bc212273

相关文章
相关标签/搜索