Browse Source

Merge pull request #236 from dinhha/master

Fixed crash issue on Flutter >= 0.10.2
Rafal Wachol 7 years ago
parent
commit
3e18cec872
1 changed files with 1 additions and 1 deletions
  1. 1 1
      ios/Classes/FlutterWebviewPlugin.m

+ 1 - 1
ios/Classes/FlutterWebviewPlugin.m

@@ -15,7 +15,7 @@ static NSString *const CHANNEL_NAME = @"flutter_webview_plugin";
                methodChannelWithName:CHANNEL_NAME
                methodChannelWithName:CHANNEL_NAME
                binaryMessenger:[registrar messenger]];
                binaryMessenger:[registrar messenger]];
     
     
-    UIViewController *viewController = (UIViewController *)registrar.messenger;
+    UIViewController *viewController = [UIApplication sharedApplication].delegate.window.rootViewController;
     FlutterWebviewPlugin* instance = [[FlutterWebviewPlugin alloc] initWithViewController:viewController];
     FlutterWebviewPlugin* instance = [[FlutterWebviewPlugin alloc] initWithViewController:viewController];
     
     
     [registrar addMethodCallDelegate:instance channel:channel];
     [registrar addMethodCallDelegate:instance channel:channel];