0

I would like to load [NSURL fileURLWithPath:@"2.html"] in UIWebView use NSURLCache, the cachedResponseForRequest: function is executed and return a NSCachedURLResponse object which is performed correctly at http:// scheme.
But The UIWebView load failed finally. Did I miss some optional?

I want to use UIWebView load html file in a compressed file, and I do not expect to uncompress the files to disk. is there any suggestion.

Frank
  • 13
  • 5

1 Answers1

0

Do this:

 NSURL *url = [[NSBundle mainBundle] URLForResource:@"2" withExtension:@"html"];
 NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
 NSURL *baseUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
 [webView loadHTMLString:html baseURL:baseUrl];
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132
  • I am sorry, but it isn't effective. It didn't load data from NSURLCache, and the html is still in compressed file. – Frank Aug 23 '12 at 11:14