Flutter: Projetc not building on iOS Simulator
Asked Answered
H

2

7

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.

Handicraftsman answered 4/1, 2022 at 12:16 Comment(4)
working fine in Android Studio or Simulator not in xcodeCoranto
Only Simulator is problematic. I am running from Android studio. Also, opened the project in the Xcode as well but Simulator was not showing up on the list.Handicraftsman
Check the certificate in the keychain access, sometimes the certificate corrupts it self when you upgrade/update flutter. Remove it from the keychain, and make Xcode create a new one.Hardee
I think, if it was a certificate issue then I would not able to build for a real iOS device, right?Handicraftsman
R
28

May be this is a solution:

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

enter image description here

Robey answered 31/1, 2022 at 8:30 Comment(2)
This fixed the problem. I also had to run sudo gem uninstall cocoapods && sudo gem install cocoapods and restart the IDE.Handicraftsman
i am facing the same issue, but there is not Supported Platform in this section of my Xcode project. there is Targeted Device Families..Befall
S
0

This worked for me.

  • in Xcode, Go to Product > Scheme > Edit Scheme.
  • In the scheme editor, select the Run tab on the left.
  • Ensure the Build Configuration is set to Debug. Release and Profile configurations are not suitable for simulator builds.
Sized answered 28/6 at 2:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.