Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Service Workers unavailable in WKWebView in iOS 11.3

Service Workers were available in WKWebView in iOS 11.3 betas, but do not appear to be available in the final GM version of iOS 11.3.

Does anyone know how to re-enable Service Workers in WKWebView on iOS?

like image 321
Andrew Ebling Avatar asked Apr 05 '18 13:04

Andrew Ebling


People also ask

Does WKWebView support service workers?

Description. Since iOS14, it's possible to make service workers works in WKWebView by providing a list of trusted domains (up to 10). These domains then gain support for service workers, which is invaluable for us as we plan to use server.

Is WKWebView the same as Safari?

WKWebView - This view allows developers to embed web content in your app. You can think of WKWebView as a stripped-down version of Safari. It is responsible to load a URL request and display the web content. WKWebView has the benefit of the Nitro JavaScript engine and offers more features.

Can I still use UIWebView?

UIWebView APIs are still supported in the upcoming iOS 13 release as well as macOS Catalina but are still going away in future releases. Sometime in the future, iOS apps may be blocked from release to the App Store when Apple decides to enforce blocking apps that use UIWebView.

Does Chrome use WKWebView?

In Chrome 48 we've made the switch from UIWebView to WKWebView, leading to dramatic improvements in stability, speed, responsiveness, and web compatibility.


1 Answers

Service Workers in WKWebView now require an entitlement:

com.apple.developer.WebKit.ServiceWorkers, which should be added to the .entitlements plist as a Boolean with a value of YES.

Currently this will only work in the iOS Simulator, until such time as Apple update the Apple Developer Portal to make it possible to create App IDs and Provisioning Profiles containing this entitlement.

For more information see this bug: https://bugs.webkit.org/show_bug.cgi?id=182865 and associated change set: https://trac.webkit.org/changeset/228933/webkit

enter image description here

EDIT: Unfortunately still seems to be the case in iOS 14.

like image 149
Andrew Ebling Avatar answered Oct 02 '22 09:10

Andrew Ebling