cocoapods pod init 报错解决

pod inti 报错如下:

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

### Command

```

/usr/local/bin/pod init

```

### Report

* What did you do?

* What did you expect to happen?

* What happened instead?

### Stack

```

   CocoaPods : 1.9.3

        Ruby : ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.x86_64-darwin21]

    RubyGems : 3.0.3.1

        Host : macOS 12.3.1 (21E258)

       Xcode : 13.3.1 (13E500a)

         Git : git version 2.32.0 (Apple Git-132)

Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib

Repositories : master - git - https://github.com/CocoaPods/Specs.git @ b5bb25dc218c20e2c23aae2d572b8bc6c3d2fca4

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

```

### Plugins

```

cocoapods-deintegrate : 1.0.4

cocoapods-plugins    : 1.0.0

cocoapods-search      : 1.0.0

cocoapods-stats      : 1.1.0

cocoapods-trunk      : 1.5.0

cocoapods-try        : 1.2.0

```

### Error

```

RuntimeError - [Xcodeproj] Unknown object version.

/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.17.1/lib/xcodeproj/project.rb:227:in `initialize_from_file'

/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.17.1/lib/xcodeproj/project.rb:112:in `open'

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

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

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

/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `'

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

/usr/local/bin/pod:23:in `

'

```

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

[!] 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.&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/7458 [closed] [24 comments]

   25 Jun 2022

 - An error occurred when executing pod init

   https://github.com/CocoaPods/CocoaPods/issues/11434 [closed] [2 comments]

   12 hours ago

 - CMake generated project is unable to find Pods framework during linkage

   https://github.com/CocoaPods/CocoaPods/issues/10676 [open] [23 comments]

   25 Jan 2022

and 77 more at:

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

解决方案:

在命令行复制粘贴一下命令:

 gem install cocoapods --pre --user    

enter之后更新cocoapods成功之后,再次pod init 就成功啦。

你可能感兴趣的:(cocoapods pod init 报错解决)