Cocoapods: RuntimeError - [Xcodeproj] Unknown object version.

Created on 25 Feb 2018  Â·  18Comments  Â·  Source: CocoaPods/CocoaPods

Report

What did you do?

Run pod init for a new project.

What did you expect to happen?

Podfile should be created successfully.

What happened instead?

Error

RuntimeError - [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.4/lib/xcodeproj/project.rb:217:in `initialize_from_file'
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.4/lib/xcodeproj/project.rb:102:in `open'
/Users/admin/.gem/ruby/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/command/init.rb:41:in `validate!'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:333:in `run'
/Users/admin/.gem/ruby/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/command.rb:52:in `run'
/Users/admin/.gem/ruby/2.3.0/gems/cocoapods-1.4.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'

CocoaPods Environment

Stack

   CocoaPods : 1.4.0
        Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
    RubyGems : 2.5.2
        Host : Mac OS X 10.13.3 (17D102)
       Xcode : 9.3 (9Q107o)
         Git : git version 2.15.1 (Apple Git-101)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 633f63ec268d45fa8c3f5771b961fadf98633e51

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.0
cocoapods-try         : 1.1.0

Project that demonstrates the issue

Tracker.zip

Reason to post an issue

I've read this issue and this issue. They don't provide any working solution and they are closed. I tried doing all the steps infinZero describes in his solution without any success. Also, I've read that the owner of the repository asks to share a sample project so that the team will be able to investigate. Since I've just created an empty project which demonstrates the issue - I decided to share it.

Most helpful comment

Sudo gem install cocoapods --pre

All 18 comments

I have found a temporary solution (inspired by this pull request). I made the project's format Xcode 8.0-compatible and CocoaPods started to work as expected. Turning it back to Xcode 9.3-compatible breaks pod init again.

red - Xcode 9.3-compatible, green - Xcode 8.0-compatible

2018-02-25 11 25 55

@iwheelbuy can you upgrade your xcodeproj gem to 1.5.6 and try again? I think this issue is already fixed.

@dnkoutso it helped!

I take it as it was fixed? :)

Going to close this one as it has already been fixed with xcodeproj 1.5.6.

Running bundle update will install the correct version of the xcodeproj gem dependency.

Sudo gem install cocoapods --pre

@veerChauhan should be gem install cocoapods --pre

gem update fixed it for me after updaing xcode to the 9.3 (9E145)

@twof thanks , it helped!

@veerChauhan According to you this solves my problem, thank you. command is
Sudo gem install cocoapods --pre(mac OS 10.13.4 Xcode3)

@twof Thanks, Fixed that mistake
@lixiaodongdg the more you get into a problem the more you become able to get rid of.

Because Rootless, use sudo gem install -n /usr/local/bin cocoapods --pre better

@hyperionstudios thx it helped!

You can use: gem install cocoapods --pre --user
If you have "While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory" error

@hyperionstudios it works also for Xcode beta 10 beta 4

Because Rootless, use sudo gem install -n /usr/local/bin cocoapods --pre better

works here. Thank you.

This might help someone as well,

I use RVM.
Had to change the ruby version from which RVM is pointing to the system one.
rvm use system
then I made gem list xcodeproj and I had two versions, (1.7.0 and 1.5.7). Removed the 1.5.7 and it started working.

OMG, I encounter this in 2021... with cocoapods 1.9.1.

Was this page helpful?
0 / 5 - 0 ratings