WKWebView cannot load files using file:// URL

Originator:benchatelain
Number:rdar://20160687 Date Originated:2015-03-13
Status:Dup of 17761459 Resolved:
Product:iOS SDK Product Version:8.2 (12D508)
Classification:Serious Bug Reproducible:Always
 
WKWebView cannot load files using file:// URL protocol that is within the app sandbox since iOS 8.0 beta 4 and 5. This worked in 8.0 beta 3, and still works in the iOS 8 simulators (all versions).

Dup of rdar://18039024 & rdar://17761459

Steps to Reproduce:
1. Create a file in your Documents folder (or Library, or Library/Caches, or tmp, or even load something in your app bundle)
2. Load that file in WKWebView as a file:// URL
3. The file will not load and result in an error


Expected Results:
WKWebView can load a file from a file URL from the app's sandbox (Documents, Library, Library/Caches, tmp, app bundle)


Actual Results:
WKWebView will not load a file from a file URL from the app's sandbox (Documents, Library, Library/Caches, tmp, app bundle)


Configuration: (hardware)
iMac 27-inch (Late 2012), iPhone 6 Plus, iPhone 6

Version & Build:
Xcode 6.2 (6C131e)
iOS Simulator 8.2 (553.8)
OS X 10.10.3 seed 3 (14D98g)

Regression:
This worked in 8.0 beta 3 and also works in all versions of the iOS 8 simulator. However, it has never worked on a device in any publicly released version of iOS 8.

Additional Notes:
There is a workaround to this issue which is demonstrable in the following sample project:
https://github.com/shazron/WKWebViewFIleUrlTest

The workaround is to copy the web content to a temporary directory inside the app sandbox and to give the WKWebView a URL to it there.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!