我刚刚将 macOS 更新到 sequoia 15,随后将 Xcode 更新到 16.0。我的 flutter 应用程序在更新之前正在运行,但现在在我的 ios 模拟器上运行,出现以下错误:
Error output from Xcode build:
↳
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:11CEC440-4A5D-41D2-8FCA-9D2D245137D7, OS:18.0,
name:iPhone 16 }
{ platform:iOS Simulator, id:11CEC440-4A5D-41D2-8FCA-9D2D245137D7, OS:18.0,
name:iPhone 16 }
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/tr/yb7b1tfj3674zn3rlk57mf6r0000gn/T/flutter_tools.COssk3/flutt
er_ios_build_temp_dirTmt5Jl/temporary_xcresult_bundle
clang: error: unsupported option '-G' for target
'x86_64-apple-ios15.0-simulator'
clang: error: unsupported option '-G' for target
'x86_64-apple-ios15.0-simulator'
clang: error: unsupported option '-G' for target
'x86_64-apple-ios15.0-simulator'
如果我运行一些其他应用程序,则没有任何错误并且运行成功。只有这个应用程序有这个错误:/
我得到的初始错误是 IPHONEOS_DEPLOYMENT_TARGET 不在可接受的版本范围 12.0-18.09 内,但我用以下方法修复了该问题:
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
但现在我收到上面的错误。我也不必在其他项目中定义这个 config.buildsettings 。它们都有类似的软件包,并且指定的 ios 版本为 12.0。
我还做了以下工作:
flutter pub cache clean
flutter pub cache repair
flutter pub get
pod install
我们也遇到过这个错误。解决办法有两个方面。我们必须将以下内容添加到 Podfile 中:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == ‘BoringSSL-GRPC’
target.source_build_phase.files.each do |file|
if file.settings && file.settings[‘COMPILER_FLAGS’]
flags = file.settings[‘COMPILER_FLAGS’].split
flags.reject! { |flag| flag == ‘-GCC_WARN_INHIBIT_ALL_WARNINGS’ }
file.settings[‘COMPILER_FLAGS’] = flags.join(' ’)
end
end
end
// ... your other Podfile settings here
其次,在 XCode 中选择目标下的 Runner,转到“构建设置”,然后搜索“允许非模块化包含在框架模块中”。在“跑步者目标”列中,将其设置为“是”。