0
我尝试过许多方法,在许多线程中指定。仍然我的WebView不加载本地js文件。 ,我已经试过UIWebView加载本地文件
NSString *tempResourcePath=[[NSBundle mainBundle] resourcePath];
NSURL *resourceUrl = [NSURL fileURLWithPath:tempResourcePath];
[webView loadHTMLString:html baseURL:resourceUrl];
NSString *html = [[NSString alloc] initWithContentsOfFile:htmlPath];
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
//resourcePath = [resourcePath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
resourcePath = [resourcePath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
resourcePath = [NSString stringWithFormat:@"file:/%@/",resourcePath];
NSURL *resourceUrl = [NSURL fileURLWithPath: resourcePath];
但没有网页视图工作的方式。任何人都可以帮我解决这个问题吗?