Skip to content

Commit e80cfd2

Browse files
committed
fix bugs WebView doesn't show in iOS (Add2App)
1 parent 7753313 commit e80cfd2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ios/Classes/FlutterWebviewPlugin.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ - (void)initWebview:(FlutterMethodCall*)call {
124124

125125
_enableZoom = [withZoom boolValue];
126126

127-
[self.viewController.view addSubview:self.webview];
127+
UIViewController* presentedViewController = self.viewController.presentedViewController;
128+
UIViewController* currentViewController = presentedViewController != nil ? presentedViewController : self.viewController;
129+
[currentViewController.view addSubview:self.webview];
128130

129131
[self navigate:call];
130132
}

lib/src/base.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class FlutterWebviewPlugin {
9595
/// - [scrollBar]: enable or disable scrollbar
9696
/// - [supportMultipleWindows] enable multiple windows support in Android
9797
/// - [invalidUrlRegex] is the regular expression of URLs that web view shouldn't load.
98-
/// For example, when web view is redirected to a specific URL, you want to intercept
99-
/// this process by stopping loading this URL and replacing web view by another screen.
98+
/// For example, when webview is redirected to a specific URL, you want to intercept
99+
/// this process by stopping loading this URL and replacing webview by another screen.
100100
Future<Null> launch(String url, {
101101
Map<String, String> headers,
102102
bool withJavascript,

0 commit comments

Comments
 (0)