RexOnRoids
RexOnRoids

Reputation: 14040

How to load a LOCAL .html file with a UIWebview?

I am trying to load an HTML file stored locally on the apps documents directory using the method shown below. It ain't workin. What am I doing wrong?

    NSLog(@"Loading Saved Copy!");
urlAddress = [[self documentsDirectory] stringByAppendingPathComponent:@"/Profile/profile.html"];


            //Create a URL object.
            NSURL *url = [NSURL URLWithString:urlAddress];
            //URL Requst Object
            NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
            //Load the request in the UIWebView.
            [webView loadRequest:requestObj];

Upvotes: 3

Views: 1127

Answers (1)

kennytm
kennytm

Reputation: 523154

Use +[NSURL fileURLWithPath:isDirectory:] instead.

Upvotes: 4

Related Questions