pod init 失败
阅读原文时间:2023年07月09日阅读:2

问题: pod init 失败,报错如下:

shenheping@shenhepingdeMacBook-Pro-2 iCar % pod init
Ignoring ffi-1.13.1 because its extensions are not built. Try: gem pristine ffi --version 1.13.1

――― 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.2.1 (21D62)
Xcode : 13.4.1 (13F100)
Git : git version 2.32.1 (Apple Git-133)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ ba914f27169ecca6373d37c4e0d2ae83f9946f93

           mPaaS\_iOS\_specs - git - https://code.aliyun.com/mpaas-public/podspecs.git @ 660c18e699b9faba4cdfeea89e691d10b8efb74f

           MyProjectSpec - git - https://git.coding.net/shpyoucan666/TestCocospadsSpec.git @ 9e26f7ba771621b5886e7db3883b6e995a4b6dab

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

```

Plugins

```
cocoapods-deintegrate : 1.0.4
cocoapods-mPaaS : 0.9.5
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…

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

解决方案:终端输入如下命令

sudo gem update xcodeproj --pr