Reputation: 1633
I have built a Flutter app. Everything was working fine until I tried to launch it on a physical device. After struggling to find a solution, I changed the Xcode configuration from debug to release and I am now able to launch the app on the physical device (by running flutter run --profile). But now, I can not succeed in launching it on the simulator. I receive the error :
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ id:C80BB36C-4498-4641-92D8-F69090A819A9 }
When I plug the device and run flutter run --profile, he asks me on which profile I want to run the app:
[1]: iPhone de Bernard (00008110-0012642011B8801E)
[2]: iPhone 14 (C80BB36C-4498-4641-92D8-F69090A819A9)
[3]: macOS (macos)
[4]: Chrome (chrome)
The iPhone 14 that Flutter proposes in the profiles is the one that is not found when I try to run the app from Android Studio on the simulator for iPhone 14.
Flutter doctor :
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4.1 22F82 darwin-arm64, locale fr-BE)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!
and Xcode 14.3.1
Upvotes: 40
Views: 42765
Reputation: 7467
In my case, the problem happened because I changed the Build Configuration in the Runner Scheme from Debug to Release in Xcode. I did this to run the app on a real device independent of the dev machine since Flutter apps don't allow that in debug mode.
This worked fine until I tried a regular debug session on an emulator using my usual VSCode workflow. What I didn't realize is that instead of permanently altering the Xcode Runner scheme, I could've just used flutter run --release for that session.
By changing the scheme in Xcode, it caused the release configuration to be used even when running via flutter run or the VSCode run button. The reason it was saying it "can't find" the emulator wasn't because it wasn't there, but because the Xcode build configuration overrides the default config and for Flutter apps, Release mode isn't valid for an iOS emulator—you can't run a Flutter app in release mode on an iOS emulator (I think?)
So, my solution was to switch the Build Configuration back to Debug in the Xcode Runner scheme and use flutter run --release when needed in the future.
Upvotes: 3
Reputation: 231
Was running into this issue with the simulators
Solution for me was just to create a new Runner scheme
https://forums.developer.apple.com/forums/thread/691414
Upvotes: 0
Reputation: 63
if you have two Xcode installed, remenber to select to the correct Xcode version,for me,this issue is I have installed Xcode14 and Xcode15, my iPhone 15 simulator need Xcode15 version to find it. so xcode-select -s /Applications/Xcode15.app
Upvotes: 3
Reputation: 117
If you have recently upgraded your Xcode, you must download latest IOS version to run your app.
If you are unable to do so using steps provided by Gabriel:-
You can try this method:-
Upvotes: 9
Reputation: 31
I had the same issue, and for me, just downloading the latest IOS version 17.5 fixed the issue.
To download the latest IOS:
Upvotes: 2
Reputation: 1633
Thanks to this thread, my problem is solved.
Briefly:
Upvotes: 97