[
https://issues.apache.org/jira/browse/CB-11074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15264002#comment-15264002
]
ASF GitHub Bot commented on CB-11074:
-------------------------------------
Github user ephemer commented on the pull request:
https://github.com/apache/cordova-plugin-wkwebview-engine/pull/8#issuecomment-215702371
@shazron in that case we'd have to remove the configuration code from
updateWithInfo because we've already established that it doesn't do anything
anyway. It'd be very frustrating for a new developer to see that code and
wonder why it does nothing at all. As far as I can see it will never work,
wkWebView.configuration is listed as `read-only` in Apple's docs. I'd also
rename `updateWithInfo` to `updateDelegates` or similar unless it breaks
something else.
If we just inited the WKWebView once in `pluginInitialize`, I'm pretty
certain the `CDVViewController.m` would fail at the `canLoadRequest:` check and
then proceed to replace the `WKWebViewEngine` with `defaultWebViewEngineClass`,
as commented in #7:
if ( (...) || ![self.webViewEngine canLoadRequest:[NSURLRequest
requestWithURL:self.appUrl]]) {
self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass)
alloc] initWithFrame:bounds];
}
Specifically this is due to the following code in `CDVWKWebViewEngine`:
https://github.com/apache/cordova-plugin-wkwebview-engine/blob/33a75172a1450e8922788cd23382cc6ec33845c7/src/ios/CDVWKWebViewEngine.m#L136
`_engineWebView` would still be nil here (because `pluginInitialize`
wouldn't have been called), which would as far as I understand (I'm
Swift-first, ObjC when necessary) be coerced to `NO`, making the above check
fail.
As far as I can see, the only clean solution to this would be to pass
`settings` into the WebViewEngine's `init` method. That is probably also the
most logical and explicit way about getting the settings from `config.xml` into
the WebView.
> WKWebView configuration is not considered
> -----------------------------------------
>
> Key: CB-11074
> URL: https://issues.apache.org/jira/browse/CB-11074
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin WKWebViewEngine
> Environment: ios
> Reporter: Alexis Kofman
> Priority: Critical
> Labels: ios, triaged
>
> Regarding the code of WKWebView.h, WKWebViewConfiguration seems to be a
> readonly property.
> {code}
> @property (nonatomic, readonly, copy) WKWebViewConfiguration *configuration;
> {code}
> But in this plugin, we are trying to update the WKWebView configuration after
> initialising it and it looks like all this part is not considered :
> https://github.com/apache/cordova-plugin-wkwebview-engine/blob/master/src/ios/CDVWKWebViewEngine.m#L146-L150
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]