From 8becc361af820b9b170ce5d67c2c8c40ea30b094 Mon Sep 17 00:00:00 2001 From: Sarah Zakarias Date: Tue, 29 Aug 2017 13:58:26 +0200 Subject: [PATCH] fix binaryMessenger in FlutterAppDelegate (flutter/engine#4030) --- .../darwin/ios/framework/Source/FlutterAppDelegate.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 25fa3f708d2..07aabfc6c50 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -214,7 +214,11 @@ // TODO(xster): move when doing https://github.com/flutter/flutter/issues/3671. - (NSObject*)binaryMessenger { - return self.rootFlutterViewController; + UIViewController* rootViewController = _window.rootViewController; + if ([rootViewController conformsToProtocol:@protocol(FlutterBinaryMessenger)]) { + return (NSObject*)rootViewController; + } + return nil; } - (NSObject*)registrarForPlugin:(NSString*)pluginKey {