CB-10228:(iOS) AppendUserAgent not working with WKWebView
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/commit/bf24bb63 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/tree/bf24bb63 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/diff/bf24bb63 Branch: refs/heads/master Commit: bf24bb63416a7961196a1ba70023c5ebdad5c955 Parents: d5591de Author: kelvinho <[email protected]> Authored: Tue Nov 29 17:20:02 2016 +0800 Committer: Shazron Abdullah <[email protected]> Committed: Mon Dec 5 14:52:33 2016 -0800 ---------------------------------------------------------------------- src/ios/CDVWKWebViewEngine.m | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/bf24bb63/src/ios/CDVWKWebViewEngine.m ---------------------------------------------------------------------- diff --git a/src/ios/CDVWKWebViewEngine.m b/src/ios/CDVWKWebViewEngine.m index e43c7ba..5d361c5 100644 --- a/src/ios/CDVWKWebViewEngine.m +++ b/src/ios/CDVWKWebViewEngine.m @@ -99,6 +99,10 @@ wkWebView.UIDelegate = self.uiDelegate; self.engineWebView = wkWebView; + if ([self.viewController isKindOfClass:[CDVViewController class]]) { + wkWebView.customUserAgent = ((CDVViewController*) self.viewController).userAgent; + } + if ([self.viewController conformsToProtocol:@protocol(WKUIDelegate)]) { wkWebView.UIDelegate = (id <WKUIDelegate>)self.viewController; } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
