Skip to content

Commit 8810c6a

Browse files
committed
(ios) Fix inappbrowser not opening on iOS 13 by using reusable window
Closes #492
1 parent 2b59941 commit 8810c6a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/ios/CDVWKInAppBrowser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
@class CDVWKInAppBrowserViewController;
2828

2929
@interface CDVWKInAppBrowser : CDVPlugin {
30+
UIWindow * tmpWindow;
31+
3032
@private
3133
NSString* _beforeload;
3234
BOOL _waitForBeforeload;

src/ios/CDVWKInAppBrowser.m

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,18 @@ - (void)show:(CDVInvokedUrlCommand*)command withNoAnimate:(BOOL)noAnimate
314314
dispatch_async(dispatch_get_main_queue(), ^{
315315
if (weakSelf.inAppBrowserViewController != nil) {
316316
float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
317-
CGRect frame = [[UIScreen mainScreen] bounds];
318-
if(initHidden && osVersion < 11){
319-
frame.origin.x = -10000;
317+
if (!tmpWindow) {
318+
CGRect frame = [[UIScreen mainScreen] bounds];
319+
if(initHidden && osVersion < 11){
320+
frame.origin.x = -10000;
321+
}
322+
tmpWindow = [[UIWindow alloc] initWithFrame:frame];
320323
}
321-
322-
UIWindow *tmpWindow = [[UIWindow alloc] initWithFrame:frame];
323324
UIViewController *tmpController = [[UIViewController alloc] init];
324-
325+
325326
[tmpWindow setRootViewController:tmpController];
326327
[tmpWindow setWindowLevel:UIWindowLevelNormal];
327-
328+
328329
if(!initHidden || osVersion < 11){
329330
[tmpWindow makeKeyAndVisible];
330331
}

0 commit comments

Comments
 (0)