Set webView.inspectable to true on iOS >= 16.4#995
Set webView.inspectable to true on iOS >= 16.4#995BBosman wants to merge 1 commit intoapache:masterfrom BBosman:inspectable
Conversation
|
Hi, #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];
}
#endifI suggest updating the PR code to match the one used in |
I agree with this. The rationale behind the way cordova-ios does it is to maintain older behaviour on older iOS devices, which xcode effectively hard-coded the web inspector as enabled for debug builds, and disabled for release builds and I think this PR should follow suite. |
|
Sorry, I pushed a comment and then tried to delete it (I’m not used to GitHub…). Anyway, I tried to apply this PR but noticed that it caused my cordova build to fail. I thought it was the double semi-colon in the change that did it but it also looks like the settings object is not working correctly either. |
Platforms affected
iOS
Motivation and Context
With the introduction of iOS 16.4 WKWebView instances will no longer be inspectable by default.
Details: Enabling the Inspection of Web Content in Apps
Description
This PR explicitly sets the inspectability to
YESagain for backwards compatibility, but offers an override option.Preferably this new setting would be set to the default
NOor wrapped in an#ifdef DEBUG, but that would be a breaking change and needs to wait till a (next) major release.Testing
Tested the code in one of our own apps.
Checklist
(platform)if this change only applies to one platform (e.g.(android))