title: How can i use UIDocumentInteractionController with MPMediaPickerController
body: <p>I implemented MPMediaPickerController</p>
  
  <pre><code>- (IBAction)pickSong:(id)sender {
      MPMediaPickerController *picker =
      [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
  
      picker.delegate                     = self;
      picker.allowsPickingMultipleItems   = NO;
      picker.prompt                       = NSLocalizedString (@"Select any song from the list", @"Prompt to user to choose some songs to play");
      picker.showsCloudItems = YES;
  
      [self presentModalViewController: picker animated: YES];
  }
  - (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) mediaItemCollection
  {
      [self dismissModalViewControllerAnimated: YES];
      if (mediaItemCollection.count &gt; 0) {
          MPMediaItem *mediaItem = [mediaItemCollection.items objectAtIndex:0];
          NSLog(@"%@ - %@, %@", [mediaItem valueForProperty:MPMediaItemPropertyTitle], [mediaItem valueForProperty:MPMediaItemPropertyArtist], [mediaItem valueForProperty:MPMediaItemPropertyAssetURL]);
  
  
          self.fileURL = [mediaItem valueForProperty:MPMediaItemPropertyAssetURL];
      }
  }
  
  - (void) mediaPickerDidCancel: (MPMediaPickerController *) mediaPicker
  {
      [self dismissModalViewControllerAnimated: YES];
  }
  </code></pre>
  
  <p>and I also implemented UIDocumentInteractionController separately to be able to open a song in any application that is able to handle it</p>
  
  <pre><code>- (IBAction)shareButtonPressed:(id)sender {
      NSURL *url = [[NSBundle mainBundle] URLForResource:@"Song.mp3" withExtension:nil];
      self.docController= [UIDocumentInteractionController interactionControllerWithURL:url];
      [self.docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
  }
  </code></pre>
  
  <p>now what I am trying to do is to merge the two of them, I want to share the song that is picked from the user, this is what I saved the song's URL <code>self.fileURL = [mediaItem valueForProperty:MPMediaItemPropertyAssetURL];</code> and I have made a simple change to the share method</p>
  
  <pre><code>- (IBAction)shareButtonPressed:(id)sender {
      NSURL *url = self.fileURL;
      self.docController= [UIDocumentInteractionController interactionControllerWithURL:url];
      [self.docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
  }
  </code></pre>
  
  <p>I thought this would work but instead what I am getting is an error saying</p>
  
  <blockquote>
    <p><strong>* Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit/UIKit-2903.23/UIDocumentInteractionController.m:1010
    2013-10-28 03:14:10.294 ShareTest[1567:60b] *</strong> Terminating app due to
    uncaught exception 'NSInternalInconsistencyException', reason:
    'UIDocumentInteractionController: invalid scheme ipod-library.  Only
    the file scheme is supported.'</p>
  </blockquote>
  
  <p>the problem is clearly with the URL, I didn't implement it well, or I think a solution for that would be to take the NSData of the MPMediaItem and save it as .mp3 file in my app, but I don't know how to achieve this as well</p>
  
  <p>Thank you in advance</p>