I want to get referenceURL for the image that I saved in the camera roll using UIImageWriteToSavedPhotosAlbum (). iOS 4.1 or higher can easily do this with AssetLibrary.
ALAssetsLibraryWriteImageCompletionBlock completionBlock = ^(NSURL* url, NSError* error) {
if (error == nil) {
savedURL = url;
}
};
UIImage * originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
NSMutableDictionary * metadata = (NSMutableDictionary *)[info objectForKey:UIImagePickerControllerMediaMetadata];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:originalImage.CGImage
metadata:metadata
completionBlock:completionBlock];
But I can not find a reasonable way in the case of earlier iOS, where the only way to save the image in the camera library is UIImageWriteToSavedPhotosAlbum (). One of the ways I'm thinking of is to search for a saved image using ALAssetsGroup, etc. This is not very convenient for me, and it only helps iOS 4.0.
Thanks in advance,
Kiyo
source
share