[Xcode/Error] can’t modify frozen String (FrozenError)というエラーに遭遇した

エラー内容

いつも通りプロジェクトにPodファイルを作成しようと、【pod init】コマンドを打った時に遭遇したエラーです。

エラー本文
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `force_encoding': **can't modify frozen String (FrozenError)**

from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `report'

from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:66:in `report_error'

from /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:396:in `handle_exception'

from /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:337:in `rescue in run'

from /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:324:in `run'

from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'

from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'

from /usr/local/bin/pod:23:in `load'

from /usr/local/bin/pod:23:in `<main>'

/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:228:in `initialize_from_file': **[Xcodeproj] Unknown object version (56). (RuntimeError)**

from /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:113:in `open'

from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command/init.rb:41:in `validate!'

from /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:333:in `run'

from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'

from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'

from /usr/local/bin/pod:23:in `load'

from /usr/local/bin/pod:23:in `<main>'

原因

Xcodeのバージョンを14に変えたから起こったので恐らくそれが原因かなぁと感じています(Cocoapodsのバージョンが古いままだった?)


解決方法

色々なサイトで原因と解決方法を見て、

  • Cocoapodsをインストールし直す
  • xcodeprojをインストールする

のどちらか(若しくは両方)で解決出来るそうです、自分は後者で解決しました。


参考文献