CocoaPods 无法使用(Xcode 14.0)

更新 Xcode 14.0 之后,使用 pod 命令,提示Xcode 版本和 CocoaPods 的版本不匹配,需要更新 CocoaPods

proj] Unknown object version (56). (RuntimeError)
    11: from /Users/sinking/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `
' 10: from /Users/sinking/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval' 9: from /Users/sinking/.rvm/gems/ruby-2.7.0/bin/pod:23:in `
' 8: from /Users/sinking/.rvm/gems/ruby-2.7.0/bin/pod:23:in `load' 7: from /Users/sinking/.rvm/gems/ruby-2.7.0/gems/cocoapods-1.11.3/bin/pod:55:in `' 6: from /Users/sinking/.rvm/gems/ruby-2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run' 5: from /Users/sinking/.rvm/gems/ruby-2.7.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run' 4: from /Users/sinking/.rvm/gems/ruby-2.7.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run' 3: from /Users/sinking/.rvm/gems/ruby-2.7.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception' 2: from /Users/sinking/.rvm/gems/ruby-2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:66:in `report_error' 1: from /Users/sinking/.rvm/gems/ruby-2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `report'

我尝试下面命令,安装预发行版本,但是不行

gem install cocoapods --pre

最终解决方法是安装新的 ruby (3.0.0 版本).
ps: rvm 是 ruby 管理命令,如果电脑没安装,具体安装方法可自行去搜索

rvm install 3.0.0

如果想看 3 版本最新,可输入 rvm list known 查看最新版本

输入命令,查看本地是否安装成功

rvm list

看到 3.0.0 版本即为成功,然后切换默认版本为 3.0.0.

rvm use 3.0.0 --default

输入 rvm list 查看一下是否切换成功

rvm list               

   ruby-2.7.0 [ x86_64 ]
=* ruby-3.0.0 [ x86_64 ]

3.0.0 版本前面出现 =* 即为切换成功,这时候

切换了 ruby,所以要重新下载 CocoaPods.

gem install -n /usr/local/bin cocoapods 

下载完成,就可以去使用 pod 了

你可能感兴趣的:(CocoaPods 无法使用(Xcode 14.0))