目录
前言
我们使用Xcode创建新项目之后,执行pod init报错。我们看一下如何解决。
一、错误重现
RuntimeError - `PBXGroup` attempted to initialize an object with unknown ISA `PBXFileSystemSynchronizedRootGroup` from attributes: `{"isa"=>"PBXFileSystemSynchronizedRootGroup", "exceptions"=>["2AB3B2832C995E4700273321"], "explicitFileTypes"=>{}, "explicitFolders"=>[], "path"=>"DemoSample", "sourceTree"=>"<group>"}` If this ISA was generated by Xcode please file an issue: https://github.com/CocoaPods/Xcodeproj/issues/new /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:359:in `rescue in object_with_uuid' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:349:in `object_with_uuid' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:300:in `block (2 levels) in configure_with_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:299:in `each' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:299:in `block in configure_with_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:296:in `each' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:296:in `configure_with_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:272:in `new_from_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:350:in `object_with_uuid' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:290:in `block in configure_with_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:287:in `each' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project/object.rb:287:in `configure_with_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:272:in `new_from_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:213:in `initialize_from_file' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.23.0/lib/xcodeproj/project.rb:113:in `open' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/command/init.rb:41:in `validate!' /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:333:in `run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>' /usr/local/bin/pod:23:in `load' /usr/local/bin/pod:23:in `<main>'
二、解决方案
1.右击项目修改文件展示方式
图1.修改项目显示方式
2.修改.xcodeproj文件
使用文本编辑器修改**.xcodeproj**文件(VSCode或者subText等)。
移除下面的文件
minimizedProjectReferenceProxies = 1;
preferredProjectObjectVersion = 77;
然后更新项目的版本,把
objectVersion = 77
改成
to objectVersion = 56;
重新运行项目执行pod相关命令。