-3
I'm trying to load local HTML file in offline situation. I found a code here;

http://stackoverflow.com/questions/4645414/how-can-i-load-a-local-html-file-into-the-uiwebview
I'm using Reachability.h of Apple and it is working but I cant load local html file.

I used to load local html with this codes

NSString *indexPath = [NSBundle pathForResource:@"index" ofType:@"html" inDirectory:nil]; [mWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:indexPath]]];


https://gist.github.com/FatihDurmus/dba74b42425fe0f71685acec7be12aa8 Here my controller code.

1 Answers1

0

You can use this code. It works.

NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"terms_en" ofType:@"html"];
webView.delegate=self;
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL:nil];

Hope this helps. :)

neha
  • 167
  • 2
  • 11