There is an error when running pod deintegrate
under /ios for React Native 0.68.2 project:
RuntimeError - [Xcodeproj] Unknown object version (56).
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:228:in `initialize_from_file'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:113:in `open'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-deintegrate-1.0.5/lib/cocoapods/command/deintegrate.rb:40:in `validate!'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/claide-1.1.0/lib/claide/command.rb:333:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod:25:in `<main>'
Here is the output of pod env
:
### Stack
```
CocoaPods : 1.11.3
Ruby : ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
RubyGems : 3.3.11
Host : macOS 12.5 (21G72)
Xcode : 14.0 (14A5270f)
Git : git version 2.32.3 (Apple Git-135)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.1.2/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
```
### Plugins
```
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.1
cocoapods-trunk : 1.6.0
cocoapods-try : 1.2.0
```
Here is the output of ruby -version
and which ruby
:
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
-e:1:in `<main>': undefined local variable or method `rsion' for main:Object (NameError)
/usr/bin/ruby
There were many similar issues posted online. gem update xcodeproj
didn’t help as there was no update.
4
Answers
Edit YourProject.xcodeproj/project.pbxproj file and change the objectVersion value to 55 will work as a workaround
I’m guessing the problem is your Xcode project file version was set to
but the POD build doesn’t support it yet.
Click on your project and in the right edge File Inspector pane make sure you see this:
If you bump that to Xcode 14.0 you’re going to see your error come back.
I set this to Xcode 13.0
pod init and install it successfully.
Solution 1
The problem is the xcode version is not matching up with your cocoapods version, you have to gem update xcodeproj, if the update still not fix, you have to gem uninstall xcodeproj and gem install xcodeproj.
Solution 2
Or, you can open .xcodeproj, in the project navigator, click the root project, check the right hand panel, Identity and type, change the Project Format to a version is below the latest version.
Solution 3
In my case, none of these two above solution works. Maybe you have the same experience too, if you have rbenv installed, and think that you are using that version, then this might be the problem. React native will use the system version instead of the rbenv version, so you have to switch to the system version using rbenv global system, and sudo gem uninstall cocoapods, then sudo gem install cocoapods.