这里是Xcode8 更新补充CocoaPods的更新
升级Xcode8之后,发觉终端执行pod update 报错提示更新
执行命令
gem list
查看已安装cocoaPods的版本
*** LOCAL GEMS ***
activesupport (4.2.6)
bigdecimal (default: 1.2.0)
bundler-unload (1.0.2)
CFPropertyList (2.3.4)
claide (1.0.1, 0.9.1)
cocoapods (1.1.1, 1.0.1, 0.39.0)
cocoapods-core (1.1.1, 1.0.1, 0.39.0)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.3, 0.9.3)
cocoapods-plugins (1.0.0, 0.4.2)
cocoapods-search (1.0.0, 0.1.0)
cocoapods-stats (1.0.0, 0.6.2)
cocoapods-trunk (1.1.2, 0.6.4)
cocoapods-try (1.1.0, 0.5.1)
colored (1.2)
escape (0.0.4)
executable-hooks (1.3.2)
fourflusher (2.0.1, 0.3.2)
fuzzy_match (2.0.4)
gem-wrappers (1.2.7)
gh_inspector (1.0.2)
i18n (0.7.0)
io-console (default: 0.4.2)
json (default: 1.7.7)
minitest (5.8.4, default: 4.3.2)
molinillo (0.5.4, 0.4.5, 0.4.4)
nanaimo (0.2.3)
nap (1.1.0)
netrc (0.7.8)
psych (default: 2.0.0)
rake (default: 0.9.6)
rdoc (default: 4.0.0)
rubygems-bundler (1.4.4)
rubygems-update (2.6.8, 2.6.6)
rvm (1.11.3.9)
test-unit (default: 2.0.0.0)
thread_safe (0.3.5)
tzinfo (1.2.2)
xcodeproj (1.4.1, 0.28.2)
我的版本是1.1.1 更新前是1.1.0 版本
执行命令更新CocoaPods,注意安装CocoaPods时把ruby的镜像源替换为taobao,此时需要把ruby 替换回rubygems的源:
gem sources --remove https://ruby.taobao.org/
gem sources -a https://rubygems.org/
运行结果
https://rubygems.org/ added to sources
执行更新
gem update cocoapods
运行结果
Updating installed gems
Updating cocoapods
Fetching: cocoapods-core-1.2.0.gem (100%)
Successfully installed cocoapods-core-1.2.0
...
Gems updated: cocoapods cocoapods-core molinillo ruby-macho
更新完成,需要更新Podfile文件内容。
Q1. pod update /install 报错
Updating local specs repositories Analyzing dependencies [!] The dependency `FMDB (~> 2.3)`isnotusedinany concrete target.
The dependency `SDWebImage (~> 3.6)`isnotusedinany concrete target.
The dependency `AFNetworking (~> 2.3.0)`isnotusedinany concrete target.
The dependency `DACircularProgress (~> 2.2.0)`isnotusedinany concrete target.
The dependency `MBProgressHUD (~> 0.8)`isnotusedinany concrete target.
The dependency `PSTCollectionView (~> 1.2.1)`isnotusedinany concrete target.
说是所用的库没有指定的target,需要修改Podfile格式(我的项目中有2个target)
platform :ios, '8.0'
target 'MyApp1' do
pod 'AFNetworking', '~> 3.1.0'
end
target 'MyApp2' do
pod 'AFNetworking', '~> 3.1.0'
end
另外一种是:
platform :ios, '8.0'
def pods
pod 'AFNetworking', '~> 3.1.0'
end
target 'MyApp1' do
pods
end
target 'MyApp2' do
pods
end
完成更新。
Q2. 我更新完成之后编译项目报错
"_OBJC_CLASS_$_", referenced from: objc-class-ref
发现是Podflie文件的内容有问题,造成的错误。
同时参考的解答
这里是安装
即之前记录的安装cocoaPods的文章,这次替换mac 之后重新安装RVM一直报错
找到原因是,rvm 安装命令如下:
$ curl -sSL https://get.rvm.io | bash
执行结果
执行命令,载入rvm环境:
$ source /Users/lihuijing/.rvm/scripts/rvm
验证是否安装正确
$ rvm -v
执行结果:
安装ruby,执行命令
$ rvm install 2.0.0
接下来根据提示操作,两次之后报错,安装提示执行了,安装成功。
接下来用RVM安装Ruby环境和[之前文章](http://blog.csdn.net/liyiyismile/article/details/48465703)提到的执行命令一样 需要注意的是 在替换ruby的镜像源命令行时把淘宝换成https,即
$ gem sources -a https://ruby.taobao.org/
感谢Sauchye提供分享