Skip to content

Commit

Permalink
Merge pull request #2 from werktools/webkit-ios-16.4-enable-inspection
Browse files Browse the repository at this point in the history
Set webView.inspectable to true for debug builds on iOS >= 16.4
  • Loading branch information
NetEvolutions committed Aug 28, 2023
2 parents 940cce4 + 5517916 commit fcf541f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ios/CDVWKWebViewEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit fcf541f

Please sign in to comment.