Repository: flutter
Issue: Application crashing randomly on initializing FlutterViewController
Labels: c: crash,platform-ios,engine,a: existing-apps,a: production,P2,c: fatal crash,team-ios,triaged-ios

I have integrated Flutter in my native iOS application. The application is crashing randomly for users and from the crash logs it appears to be happening on initializing FlutterViewController. Please refer the crash log below:

```
Crashed: com.apple.main-thread
0  Flutter                        0x10519b8bc (Missing)
1  Flutter                        0x10519bad8 (Missing)
2  Flutter                        0x1051b0f48 (Missing)
3  ModuleFlutter                 0x107305b78 @objc SearchFlutterViewController.init(engine:nibName:bundle:) + 1292 (<compiler-generated>:1292)
4  ModuleFlutter                 0x10730af2c FlutterBuildable.buildFlutterSearchScreenWith(module:) + 77 (FlutterBuildable.swift:77)
5  ModuleRouter                  0x10c46c9fc ModuleRouterHandler.navigateToFlutterSearch(source:module:) + 28 (ModuleRouter+Flutter.swift:28)
6  MainModule                        0x102a4c0f0 BaseHomeViewController.showSearch() + 4350083312 (<compiler-generated>:4350083312)
7  MainModule                        0x102a4c1ec @objc BaseHomeViewController.showSearch() + 4350083564 (<compiler-generated>:4350083564)
8  UIKitCore                      0x1a795527c -[UIApplication sendAction:to:from:forEvent:] + 96
9  UIKitCore                      0x1a72ea254 -[UIControl sendAction:to:forEvent:] + 240
10 UIKitCore                      0x1a72ea598 -[UIControl _sendActionsForEvents:withEvent:] + 352
11 UIKitCore                      0x1a72e8ed0 -[UIControl touchesEnded:withEvent:] + 532
12 UIKitCore                      0x1a798ff8c -[UIWindow _sendTouchesForEvent:] + 1244
13 UIKitCore                      0x1a79918b4 -[UIWindow sendEvent:] + 3824
14 UIKitCore                      0x1a796ce50 -[UIApplication sendEvent:] + 744
15 UIKitCore                      0x1a79ef45c __dispatchPreprocessedEventFromEventQueue + 1032
16 UIKitCore                      0x1a79f3bfc __processEventQueue + 6440
17 UIKitCore                      0x1a79eaee0 __eventFetcherSourceCallback + 156
18 CoreFoundation                 0x1a506bbe0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
19 CoreFoundation                 0x1a506bae0 __CFRunLoopDoSource0 + 204
20 CoreFoundation                 0x1a506ae28 __CFRunLoopDoSources0 + 256
21 CoreFoundation                 0x1a50653d0 __CFRunLoopRun + 776
22 CoreFoundation                 0x1a5064b90 CFRunLoopRunSpecific + 572
23 GraphicsServices               0x1bb387598 GSEventRunModal + 160
24 UIKitCore                      0x1a794e638 -[UIApplication _run] + 1052
25 UIKitCore                      0x1a7953bb8 UIApplicationMain + 164
26 MainModule                        0x1027d6394 main + 14 (main.m:14)
27 libdyld.dylib                  0x1a4d43588 start + 4
```

Flutter doctor:

```
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-AE)
    • Flutter version 1.22.5 at /Users/murtuza.saify/Documents/tools/flutter
    • Framework revision 7891006299 (7 weeks ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
      You may also want to add it to your PATH environment variable.


[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Users/murtuza.saify/Documents/tools/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.10.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.52.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.18.1

 
[✓] Connected device (1 available)            
    • iPhone 11 Pro (mobile) • CC78A4AE-D08D-4EA1-B404-A3B92D0EAFF2 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
```