Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieve the url of an image taken on the fly and saved in the gallery, how?
    text
    copied!<p>I allow the user to choose an image from the gallery or take a photo with the camera. I would to save the image path in both cases so that I can use it to display the image in a second moment.</p> <p>When the user select an image from the gallery, I can use</p> <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { if([[info valueForKey:@"UIImagePickerControllerMediaType"] isEqualToString:@"public.image"]) { NSURL *imageUrl = [info valueForKey:@"UIImagePickerControllerReferenceURL"]; } </code></pre> <p>}</p> <p>Instead, if the user takes a photo on the fly, I save it in the photo roll with:</p> <pre><code> UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); </code></pre> <p>After saving it, I would to retrieve the corresponding NSURL as the user had selected it.</p> <p>How could I do?</p> <p><strong>EDIT</strong></p> <p>My problem isn't about the image chosen from the gallery. I succeed in retrieving the url using the UIImagePickerControllerReferenceURL path. My problem is when the user takes a photo with the camera. I can write it in the photo roll, but I should find a way to automatically select it such that </p> <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info </code></pre> <p>is called again and I can use the UIImagePickerControllerReferenceURL key to retrieve the corresponding url.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload