diff --git a/src/ios/CDVWKWebViewEngine.m b/src/ios/CDVWKWebViewEngine.m index d6b24084..be1f7b6b 100644 --- a/src/ios/CDVWKWebViewEngine.m +++ b/src/ios/CDVWKWebViewEngine.m @@ -299,6 +299,20 @@ - (void)pluginInitialize if ([settings cordovaBoolSettingForKey:@"KeyboardAppearanceDark" defaultValue:NO]) { [self setKeyboardAppearanceDark]; } + + #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 + wkWebView.inspectable = [settings cordovaBoolSettingForKey:@"InspectableWebview" defaultValue:allowWebviewInspectionDefault]; + } + #endif [self updateSettings:settings];