title: Open image in gallery by using UIDocumentInteractionController
body: <p>I have many file types in my app and I have to let the user open the files while staying in the app.
  For example, I have PDF files and photo from the photo album.
  I read that <code>UIDocumentInteractionController</code> can open whatever file type I want.
  My worry is about file path: can I open also images of the photo album whose path is like:
  <code>"assets-library://"</code>?</p>
  
  <p>I tried this code:</p>
  
  <pre><code>- (void)setupDocumentControllerWithPath:(NSString *)path
  {
  
      if (path == nil || [path length] == 0) return;
      NSURL* url = [NSURL fileURLWithPath:path];
      if (self.docInteractionController == nil)
      {
          self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
  
          self.docInteractionController.delegate = self;
      }
      else
      {
          self.docInteractionController.URL = url;
      }
  
      if ([path hasPrefix:@"assets-library"])
      {
          self.docInteractionController.UTI = @"jpeg";
          CGRect rect = CGRectMake(x, y,w,h);
  
  
  if (![self.docInteractionController presentOpenInMenuFromRect:rect inView:self.view animated:YES])
              NSLog(@"Failed to open file  in Asset");
      }
      else
      {
          if (![self.docInteractionController presentPreviewAnimated:YES])
                NSLog(@"Failed to open document in Document Dir");;
      }
      url = nil;
  }
  </code></pre>
  
  <p>and I call it whenever I want to open a file at a specific path.
  For asset files, the code enter the Log "Failed to open file in Asset".</p>