8

After update IOS to 11 version, I have problem with wkwebview plugin in my app.

Ionic command released IOS 11 checklist but the problem is stay after all steps from checklist.

Ios platform version 4.4.0

Problem on any sim iPnone 5s, 6, 6s...

In screen bottom I have white space. Helps, please.

enter image description here

UPDATE: After i delete cordova-plugin-wkwebview-engine plugin white space is gone. But I need this plugin in my app.

wstudiokiwi
  • 880
  • 1
  • 15
  • 33

5 Answers5

8

About the bottom space when using wkwebview, here is a workaround:

Add some code in cordova-plugin-wkwebview-engine\src\ios\CDVWKWebViewEngine.m between line 99-100,

// re-create WKWebView, since we need to update configuration
WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration];
//add begin
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if (@available(iOS 11.0, *)) {
  [wkWebView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
#endif
//add end
wkWebView.UIDelegate = self.uiDelegate;
self.engineWebView = wkWebView;

The code above came from cordova-plugin-ionic-webview

Doctor.Who.
  • 607
  • 1
  • 7
  • 15
4

I uninstallied plugin cordova-plugin-wkwebview-engine and install cordova-plugin-ionic-webview and it`s work perfectly.

wstudiokiwi
  • 880
  • 1
  • 15
  • 33
1

None of the provided solutions worked for me. For iOS 11+ try the below, solved my problem.

Add the below line to your config.xml

<plugin name="cordova-plugin-disable-ios11-statusbar" source="npm" spec="*"/>

Goodluck!

1

Instead of disabling scrolling or forcing the removal of safe-area on the web frame, the better permanent fix is changing how Ionic stretches the app vertically on the screen. It should use a height: 100vh instead of height: 100%, per the findings in this thread: https://issues.apache.org/jira/browse/CB-12886

I have new information to add to this bug, and to reiterate it is not a Cordova bug. Let me present 3 scenarios:

  • viewport-fit=auto and CSS height: 100% on the body element:
    UIWebView: The webview is the height of the device screen, minus the unsafe area, offset at the top by the unsafe area.
    WKWebView: The webview is the height of the device screen, minus the unsafe area, offset at the top by the unsafe area.
  • viewport-fit=cover and CSS height: 100% on the body element:
    UIWebView: The webview is the height of the device screen.
    WKWebView: The webview is the height of the safe area, showing a gap at the bottom.
  • viewport-fit=cover and CSS height: 100vh on the body element:
    UIWebView: The webview is the height of the device screen.
    WKWebView: The webview is the height of the device screen.

In my main SCSS file, after importing Ionic, I've set:

html {
    height: 100vh;
}
Bart Verkoeijen
  • 16,545
  • 7
  • 52
  • 56
-3

Add viewport-fit=cover to solve this problem.

<meta name="viewport" content="viewport-fit=cover, initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
dap.tci
  • 2,455
  • 1
  • 20
  • 18