Repository: flutter
Issue: FlutterViewController is always transparent when adding Flutter to new iOS app
Labels: platform-ios,a: existing-apps,has reproducible steps,P2,found in release: 2.5,found in release: 2.6,team-ios,triaged-ios

I'm trying to add a Flutter screen to a freshly created iOS app. I'm following the official instructions here: https://docs.flutter.dev/development/add-to-app/ios/project-setup

However, the presented FlutterViewController is always transparent:
<img src="https://user-images.githubusercontent.com/5382865/144449659-b30be6f4-25bf-4f1e-ad4b-4b78083492ec.png" width="300">

I'm following Option A:  **Embed with CocoaPods and the Flutter SDK**. I.e I run `flutter create --template module my_flutter` inside my iOS app root folder. 

I then run `pod init` and setup my Podfile like this:

``` Ruby
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

# my_flutter is in the root folder
flutter_application_path = './my_flutter'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'MyFlutterApp' do
  install_all_flutter_pods(flutter_application_path)
end
```

Here's the content of my iOS files

AppDelegate.swift:
``` Swift

import UIKit
import Flutter
// Used to connect plugins (only if you have plugins with iOS platform code).
import FlutterPluginRegistrant

@main
class AppDelegate: FlutterAppDelegate {

    lazy var flutterEngine = FlutterEngine(name: "my flutter engine")
    
    override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Runs the default Dart entrypoint with a default Flutter route.
        flutterEngine.run();
        // Used to connect plugins (only if you have plugins with iOS platform code).
        GeneratedPluginRegistrant.register(with: self.flutterEngine);
        return super.application(application, didFinishLaunchingWithOptions: launchOptions);
    }
}
```

ViewController.swift
``` Swift
import UIKit
import Flutter

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Make a button to call the showFlutter function when pressed.
        let button = UIButton(type:UIButton.ButtonType.custom)
        button.addTarget(self, action: #selector(showFlutter), for: .touchUpInside)
        button.setTitle("Show Flutter!", for: UIControl.State.normal)
        button.frame = CGRect(x: 80.0, y: 210.0, width: 160.0, height: 40.0)
        button.backgroundColor = UIColor.blue
        self.view.addSubview(button)
    }
    
    @objc func showFlutter() {
        let flutterEngine = (UIApplication.shared.delegate as! AppDelegate).flutterEngine
        let flutterViewController =
        FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
        present(flutterViewController, animated: true, completion: nil)
    }
}
```

Xcode version:
```
Version 13.1 (13A1030d)
```

Cocoapods version:
```
1.11.0
```

Flutter version:
```
Flutter 2.6.0-12.0.pre.885 • channel master • https://github.com/flutter/flutter.git
Framework • revision 16ec56ee0f (7 hours ago) • 2021-12-02 02:49:05 -0500
Engine • revision 888f4c0fc6
Tools • Dart 2.16.0 (build 2.16.0-56.0.dev) • DevTools 2.8.0
```

Console output:
```
2021-12-02 16:14:41.309092+0100 MyFlutterApp[30622:1906348] [VERBOSE0:callback_cache.cc(133)] Could not parse callback cache, aborting restore
2021-12-02 16:14:41.312609+0100 MyFlutterApp[30622:1906348] Failed to find assets path for "Frameworks/App.framework/flutter_assets"
2021-12-02 16:14:41.312934+0100 MyFlutterApp[30622:1906348] Metal API Validation Enabled
2021-12-02 16:14:41.369151+0100 MyFlutterApp[30622:1906573] [VERBOSE-2:engine.cc(197)] Engine run configuration was invalid.
2021-12-02 16:14:41.369528+0100 MyFlutterApp[30622:1906573] [VERBOSE-2:shell.cc(580)] Could not launch engine with configuration.
2021-12-02 16:14:41.499905+0100 MyFlutterApp[30622:1906577] flutter: Observatory listening on http://127.0.0.1:56374/cSDZ6qRKW9I=/
2021-12-02 16:14:44.946970+0100 MyFlutterApp[30622:1906348] Writing analzed variants.
2021-12-02 16:14:44.951201+0100 MyFlutterApp[30622:1906348] Writing analzed variants.
```

flutter doctor -v:
```
[✓] Flutter (Channel master, 2.6.0-12.0.pre.885, on macOS 12.0.1 21A559 darwin-x64, locale en-GB)
    • Flutter version 2.6.0-12.0.pre.885 at /Users/gustavo/flutterCode/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 16ec56ee0f (8 hours ago), 2021-12-02 02:49:05 -0500
    • Engine revision 888f4c0fc6
    • Dart version 2.16.0 (build 2.16.0-56.0.dev)
    • DevTools version 2.8.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/gustavo/Library/Android/sdk
    • Platform android-31, build-tools 30.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_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • 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 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.62.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.29.0

[✓] Connected device (4 available)
    • iPhone 7 (mobile)  • A0585F61-9B8B-4382-AA92-914266A01723 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)
    • iPhone 13 (mobile) • 33621704-9CAD-41AF-BF02-94965B9BE658 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • macOS (desktop)    • macos                                • darwin-x64     • macOS 12.0.1 21A559 darwin-x64
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 96.0.4664.55

• No issues found!
```