ios相关点iOS开发杂货铺ios 知识点

升级CocoaPods到最新版本

2019-06-06  本文已影响0人  Frankkkkk

背景

在多人开发时,将git上项目clone下来进行pod install后,发现sourceTree上未暂存文件中xxx/Podfile.lock文件有变动,看下图

第三方库版本
CocoaPods版本

升级pod版本

既然本地cocoapods版本比较低,那就得升级CocoaPods版本

Frankkkk-2:~ aladin$ pod --version
1.5.3
Frankkkk-2:~ aladin$ gem source -l
*** CURRENT SOURCES ***

https://gems.ruby-china.org/

当前源地址为:https://gems.ruby-china.org/

Frankkkk-2:~ aladin$ sudo gem install cocoapods
Password:
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://gems.ruby-china.org/ - bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)

发现运行命令报错,原因是https://gems.ruby-china.org/地址找不到
用浏览器打开https://gems.ruby-china.org/

ruby源地址报错
上图中已经说明了域名已经更换了,那么换一下ruby源就好了。
Frankkkk-2:~ aladin$ gem sources --remove https://gems.ruby-china.org/
https://gems.ruby-china.org/ removed from sources

Frankkkk-2:~ aladin$ gem sources -a https://gems.ruby-china.com
https://gems.ruby-china.com added to sources

Frankkkk-2:~ aladin$ gem source -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com

至此,ruby源已经更新成功!

安装升级pod

运行命令sudo gem install cocoapods

Frankkkk-2:~ aladin$ sudo gem install cocoapods
Password:
Fetching: cocoapods-core-1.7.1.gem (100%)
Successfully installed cocoapods-core-1.7.1
Fetching: cocoapods-deintegrate-1.0.4.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.4
Fetching: cocoapods-downloader-1.2.2.gem (100%)
Successfully installed cocoapods-downloader-1.2.2
Fetching: cocoapods-trunk-1.3.1.gem (100%)
Successfully installed cocoapods-trunk-1.3.1
Fetching: molinillo-0.6.6.gem (100%)
Successfully installed molinillo-0.6.6
Fetching: atomos-0.1.3.gem (100%)
Successfully installed atomos-0.1.3
Fetching: xcodeproj-1.9.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

安装过程中,报了权限错误 ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.

解决办法:运行sudo gem install -n /usr/local/bin cocoapods

Frankkkk-2:~ aladin$ sudo gem install -n /usr/local/bin cocoapods
Successfully installed xcodeproj-1.9.0
Fetching: fourflusher-2.3.0.gem (100%)
Successfully installed fourflusher-2.3.0
Fetching: ruby-macho-1.4.0.gem (100%)
Successfully installed ruby-macho-1.4.0
Fetching: cocoapods-1.7.1.gem (100%)
Successfully installed cocoapods-1.7.1
Parsing documentation for xcodeproj-1.9.0
Installing ri documentation for xcodeproj-1.9.0
Parsing documentation for fourflusher-2.3.0
Installing ri documentation for fourflusher-2.3.0
Parsing documentation for ruby-macho-1.4.0
Installing ri documentation for ruby-macho-1.4.0
Parsing documentation for cocoapods-1.7.1
Installing ri documentation for cocoapods-1.7.1
Done installing documentation for xcodeproj, fourflusher, ruby-macho, cocoapods after 5 seconds
4 gems installed

安装完成后,再次确认pod版本

Frankkkk-2:~ aladin$ pod --version
1.7.1

到此,终于将pod升级到最新的1.7.1版本了。

上一篇 下一篇

猜你喜欢

热点阅读