Search code examples
iosobjective-cios5ios6

how to find the "UIImagePickerControllerOriginalImage" and "UIImagePickerControllerReferenceURL" when downloading the image from net


I want to get UIImagePickerControllerOriginalImage and UIImagePickerControllerReferenceURL when i download and save image to the photo album..

Can anyone suggest the proper method to find those 2 parameters?

if i use the method "

[library writeImageToSavedPhotosAlbum:[viewImage CGImage] orientation:(ALAssetOrientation)[viewImage imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error)

i will get "UIImagePickerControllerReferenceURL" and if i use

UIImageWriteToSavedPhotosAlbum([UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.imageURL]]], testOriginalImage, @selector(image:didFinishSavingWithError:contextInfo:), nil)

i will get "UIImagePickerControllerOriginalImage"

what to do to get both?


Solution

  • If you call:

    [library writeImageToSavedPhotosAlbum:[viewImage CGImage] orientation:(ALAssetOrientation)[viewImage imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error)
    

    then you get/have both. The assetURL is the UIImagePickerControllerReferenceURL and viewImage is the same as the UIImagePickerControllerOriginalImage.