Skip to content

Commit 8a8b298

Browse files
authored
Added a log message when sharing a FlutterEngine across multiple FlutterViewControllers. (flutter#17186)
1 parent 11f5521 commit 8a8b298

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

shell/platform/darwin/ios/framework/Source/FlutterViewController.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ - (instancetype)initWithEngine:(FlutterEngine*)engine
144144
self = [super initWithNibName:nibName bundle:nibBundle];
145145
if (self) {
146146
_viewOpaque = YES;
147+
if (engine.viewController) {
148+
FML_LOG(ERROR) << "The supplied FlutterEngine " << [[engine description] UTF8String]
149+
<< " is already used with FlutterViewController instance "
150+
<< [[engine.viewController description] UTF8String]
151+
<< ". One instance of the FlutterEngine can only be attached to one "
152+
"FlutterViewController at a time. Set FlutterEngine.viewController "
153+
"to nil before attaching it to another FlutterViewController.";
154+
}
147155
_engine.reset([engine retain]);
148156
_engineNeedsLaunch = NO;
149157
_flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]);

0 commit comments

Comments
 (0)