My requirement is to set a description of the image in the meta data and save the image in documents directory.
I found how to create meta data and meta data is getting set if I save my image to photo library but I want to save the image in the documents directory.
Please suggest how to add meta data to my image and save the image in directory.
My Code :
NSMutableDictionary *tiffMetadata = [[NSMutableDictionary alloc] init];
[tiffMetadata setObject:@"This is my description" forKey:(NSString*)kCGImagePropertyTIFFImageDescription];
NSMutableDictionary *metadata = [[NSMutableDictionary alloc] init];
[metadata setObject:tiffMetadata forKey:(NSString*)kCGImagePropertyTIFFDictionary];
ALAssetsLibrary *assetsLib = [[ALAssetsLibrary alloc] init];
NSData *imgData=[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"IMG_0015" ofType:@"jpg"]];
[assetsLib writeImageDataToSavedPhotosAlbum:imgData metadata:metadata completionBlock:^(NSURL *assetURL, NSError *error) {
if (error) {
NSLog(@"%@",error.localizedDescription);
}
}];
Any suggestions would be highly appreciated. Thanks in advance.