iosxcodeflutterios-simulator

Flutter: Projetc not building on iOS Simulator


Flutter app build fails for iOS Simulator even though it compiles successfully for Android Emulator, iOS and Android physical devices also running from command line iOS build is successful.

This issue appeared after upgrading the Flutter version to 2.8.1 from 2.5.3.

Previously, it was working fine.

Build Output

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.

This Simulator is also not showing in Xcode.

Flutter doctor output

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 version : 13.2.1

iOS version in Simulator : 15.2

Any help would be really appreciated. Thanks.


Solution

  • May be this is a solution:

    See 「build settings」 on XCode and change 「Supported platforms: iphoneos」 to 「Supported platforms: iOS」.

    enter image description here