From 24b2425483028881b4bc6fc58d9f47d842c94d28 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Mon, 23 Mar 2020 10:44:53 -0700 Subject: [PATCH] Added a log message when sharing a FlutterEngine across multiple FlutterViewControllers. (flutter/engine#17186) --- .../darwin/ios/framework/Source/FlutterViewController.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 6deed5f810..6e7e8c4958 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -144,6 +144,14 @@ typedef enum UIAccessibilityContrast : NSInteger { self = [super initWithNibName:nibName bundle:nibBundle]; if (self) { _viewOpaque = YES; + if (engine.viewController) { + FML_LOG(ERROR) << "The supplied FlutterEngine " << [[engine description] UTF8String] + << " is already used with FlutterViewController instance " + << [[engine.viewController description] UTF8String] + << ". One instance of the FlutterEngine can only be attached to one " + "FlutterViewController at a time. Set FlutterEngine.viewController " + "to nil before attaching it to another FlutterViewController."; + } _engine.reset([engine retain]); _engineNeedsLaunch = NO; _flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]);