diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 2adcf0c1b..5cf8e1570 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -18,6 +18,7 @@ Licensed to the Apache Software Foundation (ASF) under one */ #import "CDVWKInAppBrowser.h" +#import #if __has_include() // Cordova-iOS >=6 #import @@ -774,6 +775,21 @@ - (void)createViews self.webView = [[WKWebView alloc] initWithFrame:webViewBounds configuration:configuration]; + +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 + // With the introduction of iOS 16.4 the webview is no longer inspectable by default. + // We'll honor that change for release builds, but will still allow inspection on debug builds by default. + // We also introduce an override option, so consumers can influence this decision in their own build. + if (@available(iOS 16.4, *)) { +#ifdef DEBUG + BOOL allowWebviewInspectionDefault = YES; +#else + BOOL allowWebviewInspectionDefault = NO; +#endif + self.webView.inspectable = [_settings cordovaBoolSettingForKey:@"InspectableWebview" defaultValue:allowWebviewInspectionDefault]; + } +#endif + [self.view addSubview:self.webView]; [self.view sendSubviewToBack:self.webView];