Flutter:Projetc 未在 iOS 模拟器上构建

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

即使 Android 模拟器编译成功,iOS 模拟器的 Flutter 应用程序构建也会失败,同样从命令行运行的 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 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

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

ios xcode flutter ios-simulator
2个回答
28
投票

也许这是一个解决方案:

查看 XCode 上的「构建设置」,将「支持的平台:iphoneos」更改为「支持的平台:iOS」。

enter image description here


0
投票

这对我有用。

  • 在 Xcode 中,转到“产品”>“方案”>“编辑方案”。
  • 在方案编辑器中,选择 左侧的“运行”选项卡。
  • 确保构建配置设置为 调试。 Release 和 Profile 配置不适合 模拟器构建。
© www.soinside.com 2019 - 2024. All rights reserved.