title: Open file viewer (PDF) from iOS application
body: <p>We have a code to download a PDF from the server using a SOAP protocol.</p>
  
  <p>We store the file on the Documents folder of the iOs device, and the we want to allow the user to open the file (usually PDF's files)</p>
  
  <p>But, at least on the simulator, the application didn't open the file successfully. </p>
  
  <p>Of course, I can open manually the file (in order to check that the file has been downloaded perfectly) </p>
  
  <pre><code>// Get the documents folder where write the content
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
  NSString *documentsDirectory = [paths objectAtIndex:0];
  
  NSString *filePath = [documentsDirectory stringByAppendingPathComponent:documentDownloaded.fileName];
  
  if ([[NSFileManager defaultManager] fileExistsAtPath:[self getFileCompletePath]]){
      NSString *filePath = [[NSString alloc] initWithFormat:@"%@", [self getFileCompletePath]];
      NSURL *url = [[NSURL alloc] initFileURLWithPath:filePath];
  
      if ([[UIApplication sharedApplication] canOpenURL:url]){
          [[UIApplication sharedApplication] openURL: url];
      } else {
          NSLog(@"Not supported application to open the file %@", filePath);
      }
  
      [url release];
      [filePath release];
  }
  </code></pre>
  
  <p>The file full path in the simulator is:</p>
  
  <p>/Users/User/Library/Application Support/iPhone Simulator/4.3.2/Applications/87800296-2917-4F26-B864-B20069336D1D/Documents/0000907.pdf</p>
  
  <p>Anybody knows if is something wrong?</p>
  
  <p>The file could be and spreadsheet, pdf, image, document ... but for the first work around will be great just for pdf's.</p>
  
  <p>Thank you,</p>