更新到 XCode 16 Beta 后,在构建应用程序时出现此错误(在附件中),基本上就是这样。有什么方法可以解决这个问题吗?还是我应该等待 BoringSSL 更新?
我尝试过 pod 更新,更改最低部署版本,但没有帮助。
3
最佳答案
2
如果您使用 Cocoapods,这是一个快速修复方法:
将其添加到你的 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
end
end
该问题来自 GRPC:
1
-
用这个解决方案解决了。谢谢
–
|
' # Uncomment this line to define a global platform for your project
platform :ios, '16.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
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
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__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# Modify existing XCConfig settings
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
# Replace DT_TOOLCHAIN_DIR with TOOLCHAIN_DIR
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
# Remove the -G flag if it is specifically for BoringSSL-GRPC
if target.name == 'BoringSSL-GRPC'
xcconfig_mod.gsub!('-G', '') # Removing the -G flag
end
# Write back the modified configuration
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
# Additional build settings
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
config.build_settings['EXCLUDED_ARCHS'] = 'arm64' # Corrected the key name here
end
end
# Apply additional Flutter-specific settings
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
'
这解决了我的问题,将这一行添加到 Podfile 中:xcconfig_mod.gsub!('-G', '') # Removing the -G flag'
并且:在某些情况下,可能需要调整 Xcode 设置以允许在框架模块中包含非模块化。
打开 Xcode 并导航到项目的构建设置。搜索“允许框架模块中的非模块化包含”。将其设置为“是”。
1
-
我实施了指示的修复,但不幸的是它不起作用。还有其他解决方案可以实施吗?
–
|
–
–
open /Applications/Xcode.app/Contents/MacOS/Xcode
–
|