From 102f6ea1c9f5ad84e14ce432e29b3a3b3b6001f2 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 13 Nov 2018 16:04:09 -0800 Subject: [PATCH] Avoid a never-disappearing splash screen if the engine came from somewhere else on iOS (flutter/engine#6834) * Ignore multiple attemps to set splash screen, print warning --- .../ios/framework/Source/FlutterViewController.mm | 13 +++++++++++++ 1 file changed, 13 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 ceda1dd6c9..0cb5b57073 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 @@ -344,6 +344,19 @@ } - (void)setSplashScreenView:(UIView*)view { + if (!view) { + // Special case: user wants to remove the splash screen view. + [self removeSplashScreenViewIfPresent]; + } else if (_splashScreenView) { + FML_LOG(ERROR) << "Attempt to set the FlutterViewController's splash screen multiple times was " + "ignored. The FlutterViewController's splash screen can only be set once. " + "This condition can occur if a running FlutterEngine instance has been " + "passed into the FlutterViewController and a consumer later called " + "[FlutterViewController setSplashScreen:]. Setting the splash screen on a " + "FlutterViewController with an already running engine is not supported, as " + "the rasterizer will already be running by the time the view is shown."; + return; + } _splashScreenView.reset([view retain]); _splashScreenView.get().autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;