title: didFinishPickingMediaWithInfo get Image filename
body: <p>I am trying to get the image filename from the camera.  I have seen many, many posts about retrieving the filename using UIImagePickerControllerReferenceURL or UIImagePickerControllerMediaURL, but that only gets you a filename similar to: //asset/asset.JPG?id=D1D715A8-6956-49FF-AF07-CE60FE93AE32&amp;ext=JPG.  I believe this is because the image is not saved yet, thus a name like img0001.jpg in not available.</p>
  
  <p>Does anyone know how to get the filename?  I am as suing I need to do this after UIImageWriteToSavedPhotosAlbum, but I cannot seem to figure it out.</p>
  
  <p>I have seen the question asked many times, but none seem to 'really' answer it, they just always give the filename from an image chosen from the picker not from the camera.</p>
  
  <p>Thanks for any help</p>
  
  <p>** UPDATE:</p>
  
  <pre><code>-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
  {
      [self.popoverController dismissPopoverAnimated:true];
  
      NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
      [self dismissViewControllerAnimated:YES completion:nil];
      if ([mediaType isEqualToString:(NSString *)kUTTypeImage])
      {
          UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
          imageView.image = image;
          if (newMedia)
          {
              UIImageWriteToSavedPhotosAlbum(image,
                                             self,
                                             @selector(image:finishedSavingWithError:contextInfo:),
                                             nil);
  
              NSURL *refURL = [info valueForKey:UIImagePickerControllerMediaURL];
  
              // define the block to call when we get the asset based on the url (below)
              ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *imageAsset)
              {
                  ALAssetRepresentation *imageRep = [imageAsset defaultRepresentation];
                  NSLog(@"[imageRep filename] : %@", [imageRep filename]);
              };
              // get the asset library and fetch the asset based on the ref url (pass in block above)
              ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init];
              [assetslibrary assetForURL:refURL resultBlock:resultblock failureBlock:nil];
          }
      }
  }
  </code></pre>
  
  <p>My code above, but when imageRep filename is logged it is null.</p>