I have a share extension that supports images. Everything is working and I get the image from the item provider like so:
if([imageItemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeImage])
{
[imageItemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(UIImage *image, NSError *error)
{
if(image)
{
// do smth with the image here
}
}];
}
The issue is I'd like to access the image info via ALAssetsLibrary, and I don't have its URL since the loadItemForTypeIdentifier returns an UIImage directly. Any idea how to grab the image URL?
Change [imageItemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(UIImage *image, NSError *error)
to
[imageItemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(NSURL *url, NSError *error)
Notice the completion handler argument type. This will return to you the url that you are looking for.