Xcode 14 pod init报错

1.报错

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%5BXcodeproj%5D+Unknown+object+version+%2856%29.&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…

  • Pod init in xcode 14.1 and mac os ventura 13.0.1
    https://github.com/CocoaPods/CocoaPods/issues/11656 [open] [22 comments]
    6 weeks ago

  • pod init after update it to XCODE 14
    https://github.com/CocoaPods/CocoaPods/issues/11546 [open] [21 comments]
    11 Mar 2023

  • pod init error.
    https://github.com/CocoaPods/CocoaPods/issues/11930 [closed] [1 comment]
    02 Jun 2023

and 12 more at:
https://github.com/cocoapods/cocoapods/search?q=%5BXcodeproj%5D%20Unknown%20object%20version%20%2856%29.&type=Issues&utf8=✓

2.解决方法(本人亲测有效)

原因:Pod版本与Xcode版本不兼容,按顺序执行下面执行即可。

sudo gem update --system
sudo gem install -n /usr/local/bin cocoapods