我在尝试为 Flutter 项目运行 pod install 时遇到错误。错误消息表明与未知 ISA PBXFileSystemSynchronizedRootGroup 相关的 PBXGroup 初始化存在问题。以下是详细信息:

我做了什么?
我尝试在 Flutter 项目的 ios 目录中运行 pod install。

我期望会发生什么?
我期望 CocoaPods 能够安装必要的依赖项而不会出现任何错误。但结果如何呢?

我收到以下错误:
RuntimeError –
PBXGroup尝试从属性中初始化具有未知 ISA 的对象PBXFileSystemSynchronizedRootGroup

{"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

Pod文件:

# 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 中的项目设置,但没有发现任何错误配置。


最佳答案
2

在Xcode中,右键点击文件夹,在快捷菜单中选择“转换为组”,即可正常使用。

原始答案 –

看起来很奇怪,尝试更新 cocoapods(最好的方式是通过 brew)

brew upgrade cocoapods

然后删除DerivedData