fix(ios-webview): loading of local-file dependency (#6947)

Fixes loading of html dependencies when loading a local file to web view.

I've just implemented the code changes in the patch provided by @gregorywojcik [here](https://github.com/NativeScript/NativeScript/issues/6377#issuecomment-433322681)

references #6377
This commit is contained in:
Israel Merljak
2019-02-26 07:45:17 -03:00
committed by Alexander Vakrilov
parent bb5cec3ed3
commit dcad754d1d

View File

@ -131,7 +131,8 @@ export class WebView extends WebViewBase {
public _loadUrl(src: string) {
if (src.startsWith("file:///")) {
this.ios.loadFileURLAllowingReadAccessToURL(NSURL.URLWithString(src), NSURL.URLWithString(src));
var cachePath = src.substring(0, src.lastIndexOf("/"));
this.ios.loadFileURLAllowingReadAccessToURL(NSURL.URLWithString(src), NSURL.URLWithString(cachePath));
} else {
this.ios.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(src)));
}