This is an automated email from the ASF dual-hosted git repository.
manuelbeck pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git
The following commit(s) were added to refs/heads/master by this push:
new c1c6544 fix(android): fix white screen on iOS 13+ when in-app browser
window scene is nil (#1131)
c1c6544 is described below
commit c1c65446520c91bbd8daab1d3a066e9ac51f3bc5
Author: zellis-haasl <[email protected]>
AuthorDate: Wed Apr 8 11:49:29 2026 +0100
fix(android): fix white screen on iOS 13+ when in-app browser window scene
is nil (#1131)
- Adds a fallback to iterate `UIApplication.connectedScenes` when
`viewController.view.window.windowScene` returns `nil`
- documentation of `windowScene` fallback and pre iOS 13 code for
`tmpWindow`
---------
Co-authored-by: Haas Liaquat <[email protected]>
Co-authored-by: Manuel Beck <[email protected]>
---
src/ios/CDVWKInAppBrowser.m | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m
index 6497b72..71c1c9a 100644
--- a/src/ios/CDVWKInAppBrowser.m
+++ b/src/ios/CDVWKInAppBrowser.m
@@ -245,12 +245,28 @@
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf->tmpWindow) {
if (@available(iOS 13.0, *)) {
- UIWindowScene *scene =
strongSelf.viewController.view.window.windowScene;
- if (scene) {
- strongSelf->tmpWindow = [[UIWindow alloc]
initWithWindowScene:scene];
+ UIWindowScene *windowScene =
strongSelf.viewController.view.window.windowScene;
+ // The main Cordova window's scene reference isn't always
available at the time the InAppBrowser
+ // creates its temporary UIWindow. Fallback to iterate
through UIApplication.connectedScenes
+ // to get an UIWindowScene.
+ if (!windowScene) {
+ for (UIScene *connectedScene in [UIApplication
sharedApplication].connectedScenes) {
+ if (connectedScene.activationState ==
UISceneActivationStateForegroundActive &&
+ [connectedScene isKindOfClass:[UIWindowScene
class]]) {
+ windowScene = (UIWindowScene *)connectedScene;
+ break;
+ }
+ }
+ }
+ if (windowScene) {
+ strongSelf->tmpWindow = [[UIWindow alloc]
initWithWindowScene:windowScene];
}
}
+ // This code should only be executed on pre iOS 13.
+ // On scene-based iOS 13+ versions, initializing a window with
initWithFrame:
+ // would produce a window with no scene association, which
results that the
+ // window would never be displayed, which results in a
white/blank screen.
if (!strongSelf->tmpWindow) {
CGRect frame = [[UIScreen mainScreen] bounds];
if (initHidden && osVersion < 11) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]