Hi,
I am having problems loading local content in a WKWebView. I am using -loadHTMLString:baseURL: to load HTML content which refers to a few local .css and .js files. The plain HTML gets loaded, but the resources are not. The Inspector shows a few of these errors:
[Error] Not allowed to load local resource: file:///path/to/app/Debug/LibLingFR.framework/Resources/css/a_css_file.css
[Error] Failed to load resource: The operation couldn’t be completed. Operation not permitted
[Error] Failed to load resource: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 1.)
I am aware of a bug happening when the baseURL contains spaces. However, that does not seem to be the problem here.
I know this question has been asked a thousand times, but I still haven't found an explanation and I'm out of clues on what to do next. Anybody managed to solve this?
Well, I just managed to get a bit further in my comprehension of the issue.
The main app mostly manages the UI of our project, but the content I'm loading in the WKWebView is produced by a framework. The content loads fine, but WKWebView cannot load the resources which are inside the framework. I guess this is the expected behavior (for security reasons?). The only options I see are:
1) filing a feature request;
2) re-architecture of our app so that the resources to load are in the main app instead of a framework;
3) as you said, stick to the old WebView.