一、问题现象:
有人会遇到 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
测试下是否可以了。