Tuesday, January 20, 2015

WKWebView, Sandboxing, and Searching

Brent Simmons:

But the new replacement for WebView — WKWebView — doesn’t have this bug. Which is great. Let’s adopt the new thing! I’m all in. Love new things.

[…]

I did some research, and I learned that WKWebView won’t show local content — that is, files that are loaded from the app’s bundle. Files from the app bundle ought to be a-okay, ought not be a sandbox violation, but apparently they are.

[…]

In an ideal world, WKWebView would work with files from the app bundle, and, as a replacement for WebView, it would have the same functionality as WebView (a searchFor or equivalent method). Anything else means running as fast as I can while I slip backwards.

Update (2015-01-21): Chromium (via Martin Schurrer):

Unfortunately, despite the advantages of WKWebView, it has some significant technical limitations that UIWebView does not, which means we can’t simply drop it in as a replacement.

Update (2015-01-24): Dan Fabulich:

There is a workaround, demonstrated by shazron here https://github.com/shazron/WKWebViewFIleUrlTest to copy files into /tmp and load them from there.

Update (2015-04-23): The bug is still present in iOS 8.4b1.

2 Comments RSS · Twitter


[…] WKWebView Workarounds, WKWebView, Sandboxing, and Searching, […]


To load a local file with WKWebView in a sandboxed app (still, today), you need the network client entitlement.

Yes, it's silly. Yes, radars have been filed.

Leave a Comment