Repository: flutter
Issue: Cannot run flavored application on iOS Device because flutter uses one certificate for project
Labels: platform-ios,tool,d: api docs,t: xcode,P3,team-ios,triaged-ios

We have a flavored Flutter application. Each flavor has a different bundle ID from a different Apple account.

The code signing is setup correctly on the Xcode Build Configurations, I can archive and deploy all my applications without a problem, but i can only launch one flavor on an iOS device from either Android Studio or VS Code because there is a "global" iOS signing certificate set for the project. I.e., if the "project certificate" is set to the certificate of flavor "A", when I try to run the flavor "B" on an iOS Device directly from both IDEs it will try to sign the flavor "B" with the certificate of flavor "A" and the Xcode build will fail.

The only way I have to launch the apps on a real iOS device is to perform a `flutter build ios debug --flavor <flavor> -t <main-file.dart> --no-codesign` and then run the desired flavor directly from Xcode, but of course when doing that I have no debugging on the dart code.
I use this flow of performing two builds when archiving and distributing the applications and it works as expected, the only problem I face is with the debug.

Since this issue is related only to code signing, the flavors also works as expected on the iOS Simulator, I can launch any flavor I want on debug on a simulator.

I could use `flutter config --clear-ios-signing-cert` to change the cert, but of course this isn't the ideal solution because I would still be stuck to one flavor at a time.

Am I doing any configuration wrong? Is there any way to configure flutter in order to get the code signing certificate for debug builds from the iOS configurations on Xcode instead of relying on the certificate set for the project?

**Steps to reproduce**

1) I run the **alpha** flavor using `flutter run -t lib/alpha-main.dart --flavor alpha`
2) It asked me to selected a development certificate from a list of available certificates and I selected the certificate for **alpha**.
3) The certificate for **alpha** is now set as default.
4) The app build and run on my device as expected.
5) I now tries to run **beta** flavor using `flutter run -t lib/beta-main.dart --flavor beta`
6) flutter run tries to sign **beta** app with the **alpha** signing certificate.
7) The build fails.

```
flutter doctor -v
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.1 19B88, locale
    pt-BR)
    • Flutter version 1.9.1+hotfix.6 at /Users/edisonlsm/Library/flutter
    • Framework revision 68587a0916 (3 months ago), 2019-09-13 19:46:58 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/edisonlsm/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.1, Build version 11A1027
    • CocoaPods version 1.7.5

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Community Edition (version 2018.3.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.40.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (2 available)
    • iPhone            • <id> • ios • iOS
      13.2.3
    • iPhone 11 Pro Max • <id>     • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-13-1 (simulator)
```