Loading html strings in a WKWebView cannot access user documents on device

Number:rdar://29130863 Date Originated:06-Nov-2016
Status:Open Resolved:
Product:iOS Product Version:10.0.1
Classification: Reproducible:Yes
When using WKWebView.loadHTMLString(_:baseURL:) the html cannot reference files contained in the application documents. What I want to be able to do is reference a stylesheet on disk ("style.css"). I would expect to provide a base url for the directory that style.css is in so that the html can correctly reference it. This works in both the simulator and on device when the directory is in the application bundle, and works in the simulator when the directory is in application documents, but does not work on device when the directory is in application documents.

WKWebView.loadFileURL(_:allowingReadAccessTo:) does work as expected, but I cannot use it as I am handling sensitive data that cannot be stored in plaintext on disk, so I cannot write it to a file.


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!