Skip to content

Commit

Permalink
fix(iOS): IAB not showing up in apps using UIScenes (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue authored Aug 30, 2024
1 parent dfde59d commit e2d8429
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/ios/CDVWKInAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,20 @@ - (void)show:(CDVInvokedUrlCommand*)command withNoAnimate:(BOOL)noAnimate
float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf->tmpWindow) {
CGRect frame = [[UIScreen mainScreen] bounds];
if(initHidden && osVersion < 11){
frame.origin.x = -10000;
if (@available(iOS 13.0, *)) {
UIWindowScene *scene = strongSelf.viewController.view.window.windowScene;
if (scene) {
strongSelf->tmpWindow = [[UIWindow alloc] initWithWindowScene:scene];
}
}

if (!strongSelf->tmpWindow) {
CGRect frame = [[UIScreen mainScreen] bounds];
if(initHidden && osVersion < 11){
frame.origin.x = -10000;
}
strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
}
strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
}
UIViewController *tmpController = [[UIViewController alloc] init];
[strongSelf->tmpWindow setRootViewController:tmpController];
Expand Down

0 comments on commit e2d8429

Please sign in to comment.