Display PDF in UIWebView using loadData
I am trying to display a PDF I have stored locally in a UIWebView. This is how I currently attempt to do this: if (![[NSFileManager defaultManager] fileExistsAtPath:self.url]) { LOG_ERROR(@"Couldn't load local file. File at path: %@ doesn't exist", self.url); return; } nsurl=[NSURL fileURLWithPath:self.url]; NSData *data = [NSData dataWithContentsOfFile:self.url]; LOG_DEBUG(@"data length:%d",[data length]); [self.webView loadData:data MIMEType:@"application/pdf" textEncodingName:@"utf-8" baseURL:nil]; I have also tried passing nil for textEncoding, as well as using UIWebView's loadRequest. The