You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter项目执行pod install时遇PBXGroup初始化错误求助

解决pod install时PBXGroup无法初始化PBXFileSystemSynchronizedRootGroup的错误

核心解决方案

方案1:升级CocoaPods到支持Xcode 16的版本

旧版CocoaPods(如1.15.2)不兼容Xcode 16新增的PBXFileSystemSynchronizedRootGroup类型,直接升级到最新版即可:

# 卸载旧版本(可选,确保清理干净)
sudo gem uninstall cocoapods
# 安装最新版
sudo gem install cocoapods
# 或用Homebrew更新
brew upgrade cocoapods

更新完成后,回到Flutter项目的ios目录重新执行:

pod install

方案2:单独升级xcodeproj依赖

如果升级CocoaPods后问题仍存在,可直接更新CocoaPods依赖的xcodeproj库(该库负责解析Xcode项目文件):

gem update xcodeproj

再次执行pod install即可。

方案3:临时修改Xcode项目文件(紧急修复)

若无法立即升级依赖,可手动替换项目文件中的未知类型:

  1. 打开Flutter项目ios目录下的Runner.xcodeproj/project.pbxproj
  2. 全局搜索PBXFileSystemSynchronizedRootGroup,将所有匹配项替换为PBXGroup
  3. 保存文件后重新执行pod install

错误原因说明

Xcode 16引入了新的项目文件类型PBXFileSystemSynchronizedRootGroup,但你当前使用的CocoaPods 1.15.2依赖的xcodeproj 1.25.0版本并未添加对该类型的支持,导致解析Xcode项目时抛出初始化错误。升级到CocoaPods 1.16.0+或xcodeproj 1.26.0+即可兼容该新类型。


问题详情(原提问)

操作步骤:在Flutter项目的ios目录运行pod install
预期结果:CocoaPods无错误安装必要依赖
实际错误:

RuntimeError - `PBXGroup` attempted to initialize an object with unknown ISA `PBXFileSystemSynchronizedRootGroup` from attributes:
{"isa"=>"PBXFileSystemSynchronizedRootGroup", 
"exceptions"=>["E97F44AD2CB644CA004719F6"], 
"explicitFileTypes"=>{}, "explicitFolders"=>[],
"path"=>"charge_liveactivity", 
"sourceTree"=>"<group>"}

堆栈跟踪:

/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'
...

环境信息:

  • CocoaPods: 1.15.2
  • Ruby: ruby 3.3.5
  • Xcode: 16.0
  • macOS: 15.0.1
    Podfile内容:
# Uncomment this line to define a global platform for your project
platform :ios, '14.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  ...
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  ...
end

补充信息:已尝试更新CocoaPods并执行pod repo update,问题仍存在,检查Xcode项目设置未发现配置错误。


内容的提问来源于stack exchange,提问作者Ragul PR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 10:05:58