升级到 mac os sequoia 和 xcode 16 后启动 Flutter 项目时出错

问题描述 投票:0回答:1

我一直在开发一个 flutter 项目,最近我升级到了新的 macOS 和 Xcode 版本,现在我无法运行 ios 版本的应用程序,并且收到有关

DVTDeviceOperation
内部版本号的错误。 Android 没问题,这是我得到的错误:

Launching lib/main_preprod.dart on iPhone 15 in debug mode...
Xcode build done.                                           615.2s
Failed to build iOS app
Error output from Xcode build:
↳
    2024-10-08 17:39:12.778 xcodebuild[76880:259010]  DVTDeviceOperation: Encountered a build number "" that is incompatible with DVTBuildVersion.
    2024-10-08 17:39:13.535 xcodebuild[76880:259006] [MT] DVTDeviceOperation: Encountered a build number "" that is incompatible with DVTBuildVersion.
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS Simulator, id:A1C55CDA-8E1C-4CC4-8AAF-9F527F769510, OS:17.0.1, name:iPhone 15 }
    { platform:iOS Simulator, id:A1C55CDA-8E1C-4CC4-8AAF-9F527F769510, OS:17.0.1, name:iPhone 15 }
    ** BUILD FAILED **

我已经尝试将

CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES
设置为 yes,但没有成功。

这是我的 Podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'

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

project 'Runner'

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__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
      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
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' 
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        'AUDIO_SESSION_MICROPHONE=0'
      ]
    end
  end
end


target 'OneSignalNotificationServiceExtension' do
  use_frameworks!
  pod 'OneSignalXCFramework', '>= 3.4.3', '< 4.0'
end

这是我的扑动医生:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.12, on macOS 15.0 24A335 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.94.0)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

• No issues found!

要查看完整的构建日志,请查看此处

ios flutter xcode macos xcode16
1个回答
0
投票

得知您遇到了我能够解决的问题,我感到很遗憾。我制作了一个视频,其中包含如何解决该问题的分步过程。 https://www.youtube.com/watch?v=hhmDotJ8WE0&t=16s.

我希望它能帮助你解决它。

© www.soinside.com 2019 - 2024. All rights reserved.