0

I use this command to get the path of an image that I'm saving in iOS library:

UIImage *viewImage = YOUR UIIMAGE  // --- mine was made from drawing context
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];  
// Request to save the image to camera roll  
[library writeImageToSavedPhotosAlbum:[viewImage CGImage] orientation:(ALAssetOrientation)[viewImage imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){  
    if (error) {  
        NSLog(@"error");  
    } else {  
            NSLog(@"url %@", assetURL);  
    }  
}];  

I get this code in this topic:

I realize some test and the console log returns me a messange:

url assets-library://asset/asset.JPG?id=408C8B00-23DC-4DCF-9837-C294720940F9&ext=JPG

Now I want to pick this Path and put inside a UIImageView, I try this:

imageView.image = @"assets-library://asset/asset.JPG?id=408C8B00-23DC-4DCF-9837-C294720940F9&ext=JPG";

But doesn't work, someone can help me?

Community
  • 1
  • 1
  • You probably want to refer to UIImage rather than UIImageView. ImageViews are basically views with an image property – eharo2 Apr 23 '14 at 21:08
  • 1
    Possible duplicate of http://stackoverflow.com/questions/14496910/unable-to-load-image-from-asset-url. You need to use the URL to get the `ALAsset` and then pull the image of interest from its properties. – Brian Nickel Apr 23 '14 at 21:17

1 Answers1

-1

You're going to need to use imageNamed: or imageWithContentsOfFile: however, with the Asset Library I don't think you can access it directly.

Here is a stack overflow answer that shows how to access the asset url and extract the image from the library

Unable to load image from asset URL

Community
  • 1
  • 1
Walter
  • 5,867
  • 2
  • 30
  • 43
  • You can't use either of these methods to get an image from Asset Library. Instead of directly referencing another answer as effectively your entire answer, mark the question as a duplicate. – David Berry Apr 23 '14 at 22:45