Flutter:项目未在 iOS 模拟器上构建

Flutter: Projetc not building on iOS Simulator

Flutter 应用程序构建在 iOS 模拟器上失败,即使它在 Android 模拟器上成功编译,iOS 和 Android 物理设备也从命令 运行第 iOS 行构建成功。

Flutter版本从2.5.3升级到2.8.1后出现此问题。

以前,它工作正常。

生成输出

This will generate a JSON format file containing all messages that 
need to be translated.
Launching lib/src/app/main_staging.dart on iPhone 13 in debug mode...
Running Xcode build...
Xcode build done.                                            3.0s
Failed to build iOS app
Error output from Xcode build:
↳
    xcodebuild: error: Unable to find a destination matching the provided destination specifier:
            { id:1DCE4D93-E8B4-40D1-BDC1-B8FA373B1961 }

        Ineligible destinations for the "staging" scheme:
            { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }

Could not build the application for the simulator.
Error launching application on iPhone 13.

此模拟器也未在 Xcode 中显示。

Flutter 医生输出

flutter doctor -v 
[✓] Flutter (Channel stable, 2.8.1, on macOS 11.3.1 20E241 darwin-x64, locale en-GB)
    • Flutter version 2.8.1 at /Users/gohar.ali/Desktop/Flutter_dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (3 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc3)
    • Android SDK at /Users/gohar.ali/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0-rc3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Connected device (2 available)
    • iPhone (mobile) • 5d5629175f767d234062f6cfae22dc7bd3f5bc1b • ios            • iOS 14.7.1 18G82
    • Chrome (web)    • chrome                                   • web-javascript • Google Chrome 96.0.4664.110

• No issues found!

Xcode 版本 : 13.2.1

iOS 模拟器版本 : 15.2

任何帮助将不胜感激。谢谢

可能这是一个解决方案:

查看 XCode 上的“构建设置”并将“支持的平台:iphoneos”更改为“支持的平台:iOS”。