记录一次cocoaPods的更新过程


是这样的安装cocoaPods需要ruby环境,ruby的管理需要nvm,nvm的升级需要homebrew.
homebrew的升级依赖外网。
所以我们这样做
1、安装或升级homebrew
2、安装或更新ruby,选择较新版本
3、安装cocoaPods

1、安装或升级homebrew

对于不能上网的同学,不用大费周折中科大有搭建通过国内镜像方便开发人员安装。

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

引用地址
成功后查看版本

wjw@192 ~ % brew -v
Homebrew 3.3.10-21-g3ba6afb
Homebrew/homebrew-core (git revision fb70b1db1e5; last commit 2022-01-12)
Homebrew/homebrew-cask (git revision bccfa8bf06; last commit 2022-01-12)
wjw@192 ~ % 

2、安装或更新ruby,选择较新版本

由于苹果自带了ruby,之前在安装cocoaPods的时候也安装了其它版本的ruby,
通过旧版本的brew安装ruby还是怎么安装自己都忘了,
这时候推荐安装rvm,在选择相应版本的ruby.
安装rvm 命令

# 一般这个命令执行后,rvm会自动切换最新版本的ruby为默认使用版本
\curl -sSL https://get.rvm.io | bash -s stable --ruby
 source ~/.bashrc
 source ~/.bash_profile
#列出已知的ruby版本
rvm list konwn

#安装指定版本的ruby
rvm install 3.4.0 --disable-binary
# 切换ruby版本
rvm use 3.0.0
# 设置默认版本
rvm use 3.0.0 --default
# 查询已安装的ruby
rvm list
# 卸载已安装的版本
rvm remove 2.2.0

2.2 安装brew和rvm的时候出现的问题,需要切换dns

报错信息:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
github上的解决方案
switchhosts 小工具挺好用的
switchhosts下载地址

3、安装cocoaPods

sudo gem install cocoapods

安装好后记得 终端重启以下不然会出现 第四部分的大片报错,ruby的版本和cocoapods版本不匹配

4、pod install 时遇到的问题:

wjw@192 DemoInOne % pod install
Analyzing dependencies

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

/Users/wjw/.rvm/rubies/ruby-2.4.1/bin/pod install


### Report

* What did you do?

* What did you expect to happen?

* What happened instead?


### Stack

CocoaPods : 1.10.1
Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
RubyGems : 2.7.7
Host : macOS 11.5.2 (20G95)
Xcode : 13.0 (13A233)
Git : git version 2.30.1 (Apple Git-130)
Ruby lib dir : /Users/wjw/.rvm/rubies/ruby-2.4.1/lib
Repositories : master - git - https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git @ 916c5c945adee63bb321d04ed90df554bc818af4

           trunk - CDN - https://cdn.cocoapods.org/

### Plugins

cocoapods-clean : 0.0.1
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0


### Podfile

```ruby
platform :ios, '9.0'

target:'DemoInOne' do
    
pod 'AFNetworking', '~> 3.1.0'
pod 'Masonry', '~>1.1.0'
pod 'MBProgressHUD', '1.1.0'
pod 'YYKit', '~> 1.0.9'
#pod 'YYCache', '~> 1.0.4'
#pod 'YYModel', '~> 1.0.4'
pod 'IQKeyboardManager'
pod 'BaiduMapKit', '~> 6.0.0'
pod 'BMKLocationKit', '~> 2.0.0'
# pod 'MMDrawerController', '~> 0.6.0'
# pod 'MLeaksFinder'
# pod 'SDWebImage', '~> 4.3.3'
# pod 'FBRetainCycleDetector', '~> 0.1.4'
# pod 'RadioButton'
# pod 'LeakFinder'
# pod 'DXPopover', '~> 0.1.1'
# pod 'LFKit/Component/LFBubbleView'
# pod 'WYPopoverController', '~> 0.2.0'
# pod 'FMDB', '~> 2.7.2'
# pod 'MJRefresh', '~> 3.1.15.3'
# pod 'JPFPSStatus', '~> 0.1.1'
# pod 'FHHFPSIndicator'
# pod 'HJCornerRadius', :git => 'https://github.com/panghaijiao/HJCornerRadius.git'
# pod 'CocoaLumberjack', '~> 3.4.2'
# pod 'SAMKeychain', '~> 1.5.3'
# pod "PromiseKit/CorePromise", "~> 6.8"
end

Error

RuntimeError - [Xcodeproj] Unknown object version.
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:227:in `initialize_from_file'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:112:in `open'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1186:in `block (2 levels) in inspect_targets_to_integrate'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1185:in `each'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1185:in `block in inspect_targets_to_integrate'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1180:in `inspect_targets_to_integrate'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:106:in `analyze'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/bin/pod:55:in `'
/Users/wjw/.rvm/rubies/ruby-2.4.1/bin/pod:23:in `load'
/Users/wjw/.rvm/rubies/ruby-2.4.1/bin/pod:23:in `
' /Users/wjw/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:22:in `eval' /Users/wjw/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:22:in `
'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=[Xcodeproj]+Unknown+object+version.&type=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...

  • RuntimeError - [Xcodeproj] Unknown object version.
    https://github.com/CocoaPods/CocoaPods/issues/11125 [closed] [1 comment]
    2 weeks ago

  • RuntimeError - [Xcodeproj] Unknown object version
    https://github.com/CocoaPods/CocoaPods/issues/11069 [closed] [4 comments]
    4 weeks ago

  • RuntimeError - [Xcodeproj] Unknown object version.
    https://github.com/CocoaPods/CocoaPods/issues/10984 [closed] [15 comments]
    4 weeks ago

and 75 more at:
https://github.com/cocoapods/cocoapods/search?q=[Xcodeproj] Unknown object version.&type=Issues&utf8=?
wjw@192 DemoInOne %