WKWebView stops loading local resources

Hello!

Just intalled latest beta of iOS 10.3 (14E5230) and noticed that WKWebView doesn't load local resources. The page located on the disk loads fine but resources which are required by the page don't. So I have my page loaded in WKWebView but it hasn't access to style sheets and images it requires.

The app loads page by WKWebView loadFileURL:allowingReadAccessToURL: and has NSAllowsArbitraryLoads key in Info.plist. BTW, loadHTMLString:baseURL: doesn't work as well.

Web inspector says "Not allowed to load local resource".

The same app work without issues in iOS <= 10.2.


Does anybody know is this a bug or is this because of some changes in iOS 10.3?

Replies

Hi,

We are hitting a similar issue with the latest beta of macOS (10.12.4) but we invoke loadHTMLString where the html string links to resoures on disk.

Has any one confirmed that this is a bug ?

Regards,

Jimmy

Not yet. I made a bug report 30248426 on January 28th but can't say if it was noticed.

Update: marked as "Duplicate of 30233586 (Open)".

On the beta version of macOS the issue only occures if there's a space in the path even though it get converted to a valid URL (space gets converted to %20 etc). Is there any space in your path ?

I have just entered a bug report as well; can confirm seeing the same issue where local JS resources are failing to load.

Has anyone heard back from Apple that this is indeed a bug rather than a feature? :-)

My bug report was marked as a duplicate, so it looks like a legitimate bug.

Be sure to add your report # to your comment for reference, thanks.

Yes, can confirm that. If the full path to the resource has a space in it then the resource isn't loaded. In my case html-file and resources are located in Application Support directory, changing it to Caches, for example, fixes the issue. NB: in html-file resources were defined with relative paths without spaces.

Any updates on this? We've had a number of negative reviews in the app store of users on the 10.3 beta due to this bug and we are unable to fix it on our end. I'm not even sure why users are allowed to leave reviews when running a beta iOS version


EDIT - this was fixed in today's 10.3 Beta 2

Happy to know it was fixed.

As mentioned above (https://forums.developer.apple.com/message/208520#209162) the problem was in paths that contain spaces.

It does not work for me. I ran app in iOS 9.0, 9.3 and 10.3 versions. I tried with "loadHTMLString: baseURL:, loadRequest, loadFileURL: allowingReadAccessToURL:" methods but it does not work. Is still under any bug fixing by Apple? does anyone find any alternative to load local files?