Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pod init after update it to XCODE 14 #11546

Open
perceptionfoundry opened this issue Sep 18, 2022 · 24 comments
Open

pod init after update it to XCODE 14 #11546

perceptionfoundry opened this issue Sep 18, 2022 · 24 comments

Comments

@perceptionfoundry
Copy link

perceptionfoundry commented Sep 18, 2022

Cocoapods Version 1.11.2
Xcode 14.0
MacOS 12.6

I created a new Xcode project using storyboard, open terminal, & pod init then terminal had showed following error

Screenshot 2022-09-19 at 2 23 48 AM
]
Traceback (most recent call last):
9: from /Users/shahrukh/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in <main>' 8: from /Users/shahrukh/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in eval'
7: from /Users/shahrukh/.rvm/gems/ruby-2.7.0/bin/pod:23:in <main>' 6: from /Users/shahrukh/.rvm/gems/ruby-2.7.0/bin/pod:23:in load'
5: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/bin/pod:55:in <top (required)>' 4: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in run'
3: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:333:in run' 2: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/command/init.rb:41:in validate!'
1: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:113:in open' /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:228:in initialize_from_file': [Xcodeproj] Unknown object version (56). (RuntimeError)
11: from /Users/shahrukh/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in <main>' 10: from /Users/shahrukh/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in eval'
9: from /Users/shahrukh/.rvm/gems/ruby-2.7.0/bin/pod:23:in <main>' 8: from /Users/shahrukh/.rvm/gems/ruby-2.7.0/bin/pod:23:in load'
7: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/bin/pod:55:in <top (required)>' 6: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in run'
5: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:324:in run' 4: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:337:in rescue in run'
3: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:396:in handle_exception' 2: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:66:in report_error'
1: from /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:34:in report' /Users/shahrukh/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:34:in force_encoding': can't modify frozen String: "[Xcodeproj] Unknown object version (56)." (FrozenError)

@dnkoutso
Copy link
Contributor

gem update xcodeproj.

@dnkoutso dnkoutso reopened this Sep 19, 2022
@mengruirui
Copy link

https://t.csdn.cn/VqjyA 可以看看这个解决方案

@xiaoMing0109
Copy link

sudo gem install xcodeproj can resolve it.

@tungdangplus
Copy link

Thank to thanhnam1042: "brew uninstall cocoapods" and reinstall cocoapods with "sudo gem install cocoapods"
This fixed for my project created by Xcode 14

@sulemanAbrar1996
Copy link

gem update xcodeproj.

That worked for me

@chuheridangwu
Copy link

sudo gem install xcodeproj

That worked for me

@nailaobaba
Copy link

https://t.csdn.cn/VqjyA 可以看看这个解决方案

this solved my problem

@vsukhikh
Copy link

vsukhikh commented Oct 9, 2022

https://t.csdn.cn/VqjyA 可以看看这个解决方案

this solved my problem

That works! change Project Format from Xcode 14.0-compatible to Xcode 13.0-compatible

@kodakvn
Copy link

kodakvn commented Oct 13, 2022

sudo gem install xcodeproj
This solved my problems too!
Thank you very much!

@one1color
Copy link

try it out this:
brew uninstall cocoapods
then
sudo gem install cocoapods
pod init

@lzttxs
Copy link

lzttxs commented Nov 7, 2022

  1. 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.

  2. 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.

  3. 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.

org link:https://www.albertgao.xyz/2021/05/15/how-to-solve-xcodeproj-unknown-object-version/

@GeoMonstar
Copy link

GeoMonstar commented Nov 10, 2022

use Rosetta open console

@dougboberg
Copy link

Updating xcodeproj does not solve this issue for me. I am already at the most recent version.

gem update xcodeproj   
Updating installed gems
Nothing to update
gem list
xcodeproj (1.22.0)
which gem
/usr/bin/gem
gem --version
3.0.3.1
which pod
/opt/homebrew/bin/pod
pod --version
1.11.3

Manually editing proj.xcodeproj/project.pbxproj to version 55 works. I realize "56" should work, but it does not.


Command

/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod install

Stack

   CocoaPods : 1.11.3
        Ruby : ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
    RubyGems : 3.3.11
        Host : macOS 13.0 (22A380)
       Xcode : 14.1 (14B47b)
         Git : git version 2.37.1 (Apple Git-137.1)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.1.2_1/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

Podfile

target 'err' do
  pod 'AWSS3'
end

Error

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-1.11.3/lib/cocoapods/installer/analyzer.rb:1190:in `block (2 levels) in inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1189:in `each'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1189:in `block in inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1184:in `inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:106:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:416:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:161:in `install!'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/claide-1.1.0/lib/claide/command.rb:334: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>'

@pen110
Copy link

pen110 commented Nov 11, 2022

sudo gem install xcodeproj can resolve it.

That worked for me

@phanlinh9011
Copy link

try it out this:
brew uninstall cocoapods
then
sudo gem install cocoapods
pod init

Work for me at this case, thank you

@dougboberg
Copy link

My issue was solved by reinstalling homebrew cocoapods and forcing it to create new symlinks. Simply uninstalling & reinstalling failed so I had to do a doctor and cleanup as well:

brew uninstall cocoapods
brew doctor  
brew cleanup
brew install cocoapods 

At this point homebrew failed to install the cocoapods symlinks related to xcodeproj. I had to force them with

brew link --overwrite --dry-run cocoapods
brew link --overwrite cocoapods  

In my scenario the root cause was homebrew not upgrading the xcodeproj dependency correctly.

You can see in my previous comment that the homebrew cocoapods 1.11.3 was still using xcodeproj 1.21.0 /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:228.
#11546 (comment)

I routinely upgrade cocoapods using brew upgrade cocoapods. My cocoapods install was upgraded from some prior cocoapods 1.x version and did not receive the updated xcodeproj 1.22.0 within its libexec directory. A complete uninstall and reinstall was required.

@andrethegiant1969
Copy link

My issue was solved by reinstalling homebrew cocoapods and forcing it to create new symlinks. Simply uninstalling & reinstalling failed so I had to do a doctor and cleanup as well:

brew uninstall cocoapods
brew doctor  
brew cleanup
brew install cocoapods 

At this point homebrew failed to install the cocoapods symlinks related to xcodeproj. I had to force them with

brew link --overwrite --dry-run cocoapods
brew link --overwrite cocoapods  

In my scenario the root cause was homebrew not upgrading the xcodeproj dependency correctly.

You can see in my previous comment that the homebrew cocoapods 1.11.3 was still using xcodeproj 1.21.0 /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:228. #11546 (comment)

I routinely upgrade cocoapods using brew upgrade cocoapods. My cocoapods install was upgraded from some prior cocoapods 1.x version and did not receive the updated xcodeproj 1.22.0 within its libexec directory. A complete uninstall and reinstall was required.

Worked like a charm, thanks dougboberg.

@Zhitu1234
Copy link

  1. 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.
  2. 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.
  3. 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.

org link:https://www.albertgao.xyz/2021/05/15/how-to-solve-xcodeproj-unknown-object-version/

i had followed this ,it works,thanks!

@tulevan5
Copy link

brew uninstall cocoapods
sudo gem install cocoapods
pod init
pod install

=> Work for me, thank you

@neha275
Copy link

neha275 commented Jan 31, 2023

brew uninstall cocoapods
sudo gem install cocoapods
sudo gem update xcodeproj
pod init

This work for me

@gbfansheng
Copy link

gbfansheng commented Mar 11, 2023

  1. 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.
  2. 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.
  3. 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.

org link:https://www.albertgao.xyz/2021/05/15/how-to-solve-xcodeproj-unknown-object-version/

Which Solution 1 says it's right, if look in to the source code which cause the exception,you will find out it is a version problem.

Solution by reinstall the cocoapods is right, however you should be aware of the cocoapods version you are using after updated. In my case, i ran the "sudo gem uninstall cocoapods" "sudo gem install cocoapods", but the pod i use is still old version. It may cause by the env problem.(You can use "which pod" to find out if pod is already updated)

After i ran the command in the link below to delete cocoapods one by one, and reinstall, i finally succeed in update the pod.
https://juejin.cn/post/6844903951473754126

@tanujnotes
Copy link

I combined 2 of the answers here and did this:

brew uninstall cocoapods
brew doctor
brew cleanup
sudo gem install cocoapods

It worked after that.

@ferhatlageyik
Copy link

gem install --user-install cocoapods
echo 'export PATH="$HOME/.gem/ruby/2.6.0/bin:$PATH"' >> ~/.bashrc
and restart terminal
source ~/.bashrc
then go to your project directory and write pod init.
this solution work for me.

@dhavalagile
Copy link

Updating the Xcode project format to a lower version (e.g., Xcode 13/12) can resolve this issue.
Screenshot 2023-12-29 at 11 56 10 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests