pod 更新第三方依赖 遇到的问题:RuntimeError - [Xcodeproj] Unknown object version

时间:2024-03-15 18:20:48

今天使用 pod inttall 更新第三方依赖遇到:
RuntimeError - [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.2/lib/xcodeproj/project.rb:217:in initialize_from_file'
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.2/lib/xcodeproj/project.rb:102:in
open’
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:903:in block (2 levels) in inspect_targets_to_integrate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:902:in
each’
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:902:in block in inspect_targets_to_integrate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in
section’
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:897:in inspect_targets_to_integrate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:69:in
analyze’
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:242:in analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:154:in
block in resolve_dependencies’
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:153:in
resolve_dependencies’
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:116:in install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command/install.rb:41:in
run’
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in
run’
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/bin/pod:55:in <top (required)>'
/usr/local/bin/pod:23:in
load’
/usr/local/bin/pod:23:in `’

网上看到很多方法,但是都有问题。
首先遇到这个问题需要更新cocoaPods的版本的版本,但是使用:gem install cocoapods –pre更新的时候又遇到:
ERROR: Could not find a valid gem ‘cocoapods’ (>= 0), here is why:
Unable to download data from https://ruby.taobao.org/ - bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
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://ruby.taobao.org/ 已经停止维护,这个在打开这个地址的页面上可以看到,
pod 更新第三方依赖 遇到的问题:RuntimeError - [Xcodeproj] Unknown object version
但是这个页面中如何使用的内容也有问题,目前 https://gems.ruby-china.org/ 的域名已经不再是org结尾了,这个可以打开这个链接看到pod 更新第三方依赖 遇到的问题:RuntimeError - [Xcodeproj] Unknown object version
所以啊,我百度了半天都没找到最终的解决方式……
因此在这里需要把之前的镜像地址删掉并添加https://gems.ruby-china.com/
1.查看本地已有的镜像地址:gem sources -l
使用gem sources –remove [地址],删掉之前的已经失效的地址,添加https://gems.ruby-china.com/
gem sources –add https://gems.ruby-china.com/
然后再使用gem install cocoapods –pre更新就可以解决这个问题