title: Display PDF in UIWebView using loadData
body: <p>I am trying to display a PDF I have stored locally in a UIWebView. This is how I currently attempt to do this:</p>
  
  <pre><code>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];
  </code></pre>
  
  <p>I have also tried passing nil for textEncoding, as well as using UIWebView's loadRequest. The result is a UIWebView that displays a blank page. No errors occur in the UIWebView delegate method. The strange thing is that data has the correct length, in bytes, for the PDF I am trying to display, which means the file is being found and loaded correctly.</p>
  
  <p>Does anyone have an idea as to what might be going wrong here or how I can better debug this problem?</p>