From 3e247247553b81adfb5855cb5aa154d9325c2f7c Mon Sep 17 00:00:00 2001 From: pepsin Date: Fri, 22 Jan 2021 07:34:02 +0800 Subject: [PATCH] Fix background crash when FlutterView going appear while app goes background (flutter/engine#23175) --- .../darwin/ios/framework/Source/FlutterViewController.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 df26adc950..42eb02efdf 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 @@ -664,8 +664,9 @@ static void sendFakeTouchEvent(FlutterEngine* engine, TRACE_EVENT0("flutter", "viewDidAppear"); [self onUserSettingsChanged:nil]; [self onAccessibilityStatusChanged:nil]; - [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"]; - + if (UIApplication.sharedApplication.applicationState == UIApplicationStateActive) { + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"]; + } [super viewDidAppear:animated]; }