I have a “download manager” integrated into my iPhone App which allows the user to save a webpage online to their documents folder on their device to view offline and locally. This works perfectly, except the files show with lots of HTML code rather than what they should look like.
Here’s the UITableView with files: http://cl.ly/3D2g0o3C3a302J243D3v
Here’s the UIWebView with the HTML in it instead of the usual webpage: http://cl.ly/2s1h3H3D1c1t3y1J2G0W
I’m loading my UIWebView like this (looks all fine?):
NSURL *url = [[NSURL alloc] initFileURLWithPath:documentsDirectory];
NSURLRequest *req = [[NSURLRequest alloc] initWithURL:url];
[webView loadRequest:req];
Why is this happening and what can I do to rectify this?
Use this line of code my friend,
and here is a code that i use before:
now, you have the file path in your document directory.
then: