一:Xcode 16 使用 pod 命令报错解决方案

一、问题现象:

有人会遇到 Xcode 升级到 16 后,新建应用然后使用 pod init命令会报错如下:

1,报错简介信息如下:

RuntimeError - `PBXGroup` attempted to initialize an object with unknown ISA `PBXFileSystemSynchronizedRootGroup` from attributes: `{"isa"=>"PBXFileSystemSynchronizedRootGroup", "exceptions"=>["3A838D4F2CA3ED7800EBAD00"], "explicitFileTypes"=>{}, "explicitFolders"=>[], "path"=>"ShareFileds", "sourceTree"=>"<group>"}`
If this ISA was generated by Xcode please file an issue: https://github.com/CocoaPods/Xcodeproj/issues/new
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/x

2,报错详情信息如下:

[!] The version of CocoaPods used to generate the lockfile (1.16.2) is higher than the version of the current executable (1.15.2). Incompatibility issues may arise.

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/bin/pod install

### Report

* What did you do?

* What did you expect to happen?

* What happened instead?


### Stack

   CocoaPods : 1.15.2
        Ruby : ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [arm64-darwin23]
    RubyGems : 3.5.18
        Host : macOS 15.3.1 (24D70)
       Xcode : 16.2 (16C5032a)
         Git : git version 2.45.1
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.3.5/lib
Repositories : cocoapods - git - https://github.com/CocoaPods/Specs.git @ 5d58e0ae26580bf632f9ae9310c26dca6182033f

               trunk - CDN - https://cdn.cocoapods.org/
               tsinghua-git-cocoapods - git - https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git @ fd83e41c482dc99f51554d60a0ee207697a6b6fb

### 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

ruby
# Uncomment the next line to define a global platform for your project
platform :ios, '12.0'
source 'https://github.com/CocoaPods/Specs.git'
# flutter_application_path 是flutter 工程的项目路径
flutter_application_path = '../SSB-Flutter/flutter_project'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
post_install do |installer|
  flutter_post_install(installer) if defined?(flutter_post_install)
end

target 'SSBApp' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
 use_frameworks!
 # 这边引入
 install_all_flutter_pods(flutter_application_path)

 pod 'YYCache', '~> 1.0.4'
 pod 'AFNetworking', '~> 4.0.1'
 pod 'FMDB','~> 2.7.5'
 pod 'Reachability', '~> 3.2'
 pod 'XMPPFramework', '~> 3.7.0'
 pod 'MJExtension', '~> 3.0.17'
 pod 'IGListKit','~> 3.4.0'
 pod 'SDWebImage', '~> 5.0.3'
 pod 'Masonry', '~> 1.1.0'
 pod 'MJRefresh', '~> 3.0.8'
 pod 'MBProgressHUD', '~> 0.9.1'
 pod 'FWPopupViewOC','~>3.0.4'
 pod 'DGActivityIndicatorView'
 pod 'SocketRocket', '~> 0.6.0'
 pod 'SBJson', '~> 4.0.2'
# pod 'UMCCommon','~> 2.1.1'
# pod 'UMCAnalytics','~> 6.0.5'
 pod 'SwiftyJSON', '~> 4.3.0'
 pod 'YYImage'
 pod 'SSZipArchive'
 pod 'YYCategories'
 pod 'YYModel'
 pod 'CocoaAsyncSocket'
# pod 'Bugly', '~> 2.6.1'
 
#  pod 'SocketIO'
#  pod 'Starscream', '~> 4.0.6'
 
end

#def update_xcconfig(xcconfig_path, key, value)
#  # read from xcconfig to build_settings dictionary
#  build_settings = Hash[*File.read(xcconfig_path).lines.map{|x| x.delete!("\n").split(/\s*=\s*/, 2)}.flatten]
#  
#  # modify key
#  if build_settings.has_key?(key)
#    if build_settings[key].index(value) == nil
#      build_settings[key] << value
#    end
#  else
#    build_settings[key] = value
#  end
#  
#  # write build_settings dictionary to xcconfig
#  File.open(xcconfig_path, "w+") {|file|
#    build_settings.each do |k, v|
#      file.puts "#{k} = #{v}"
#    end
#  }
#end
#
## post_install hook
#post_install do |installer|
#  installer.pods_project.targets.each do |target|
#    target.build_configurations.each do |config|
#      xcconfig_path = config.base_configuration_reference.real_path
#      update_xcconfig(xcconfig_path, 'OTHER_LDFLAGS', ' -Wl,-weak-lswiftCoreGraphics')
#    end
#  end
#end

### Error

RuntimeError - `PBXGroup` attempted to initialize an object with unknown ISA `PBXFileSystemSynchronizedRootGroup` from attributes: `{"isa"=>"PBXFileSystemSynchronizedRootGroup", "exceptions"=>["3A838D4F2CA3ED7800EBAD00"], "explicitFileTypes"=>{}, "explicitFolders"=>[], "path"=>"ShareFileds", "sourceTree"=>"<group>"}`
If this ISA was generated by Xcode please file an issue: https://github.com/CocoaPods/Xcodeproj/issues/new
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:359:in `rescue in object_with_uuid'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:349:in `object_with_uuid'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:300:in `block (2 levels) in configure_with_plist'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:299:in `each'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:299:in `block in configure_with_plist'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:296:in `each'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:296:in `configure_with_plist'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project.rb:272:in `new_from_plist'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:350:in `object_with_uuid'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:290:in `block in configure_with_plist'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:287:in `each'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project/object.rb:287:in `configure_with_plist'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project.rb:272:in `new_from_plist'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project.rb:213:in `initialize_from_file'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/xcodeproj-1.25.0/lib/xcodeproj/project.rb:113:in `open'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:1194:in `block (2 levels) in inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:1193:in `each'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:1193:in `block in inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:1188:in `inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:107:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:422:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:162:in `install!'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/bin/pod:25:in `<main>'
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%60PBXGroup%60+attempted+to+initialize+an+object+with+unknown+ISA+%60PBXFileSystemSynchronizedRootGroup%60+from+attributes%3A+%60%7B%22isa%22%3D%3E%22PBXFileSystemSynchronizedRootGroup%22%2C+%22exceptions%22%3D%3E%5B%223A838D4F2CA3ED7800EBAD00%22%5D%2C+%22explicitFileTypes%22%3D%3E%7B%7D%2C+%22explicitFolders%22%3D%3E%5B%5D%2C+%22path%22%3D%3E%22ShareFileds%22%2C+%22sourceTree%22%3D%3E%22%3Cgroup%3E%22%7D%60%0AIf+this+ISA+was+generated+by+Xcode+please+file+an+issue%3A+https%3A%2F%2Fgithub.com%2FCocoaPods%2FXcodeproj%2Fissues%2Fnew&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...
Searching for inspections failed: undefined method `map' for nil

二、解决方案

第一步,打开工程,如下:


image.png

打开工程程序 - 选中左侧 - 所有蓝色文件夹📂 - 单个点击每个蓝色文件夹📂 - 右键选择 Convert to Group。选择Convert to Group完成后,文件夹会变成灰色,如上图,就是处理完成后的效果。

注:
①. 所有蓝色的文件夹📂,单个点击开都需要右键选择 Convert to Group
②. 灰色文件夹,右键后就不会出现Convert to Group这个选项。

第二步:使用文本编辑器打开 xxxxx.xcodeproj文件操作【或者直接 去到项目根目录右击 xxxxx.xcodeproj文件 - 显示包内容】:

image.png

1、打开 xxxxx.xcodeproj 文件后,找到 project.pbxproj 文件
2、修改 project.pbxproj文件中以下内容:

objectVersion = 77;
改为:
objectVersion = 63;  // 如果 63 不行,可以试试 56 

image.png

然后使用关键词 PBXFileSystemSynchronizedRootGroup 全文搜索,删除如图中的代码段:【搜不出来,就无需处理】
image.png

保存修改,然后退出。
最后,你可以执行 pod init 以及pod install 测试下是否可以了。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,869评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,716评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,223评论 0 357
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,047评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,089评论 6 395
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,839评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,516评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,410评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,920评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,052评论 3 340
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,179评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,868评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,522评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,070评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,186评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,487评论 3 375
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,162评论 2 356

推荐阅读更多精彩内容