I have a picker that saves my image in NSDocumentDirectory, here:
for (int i = 0; i < image.count; i++) {
NSLog(@"%@", [image objectAtIndex:i]);
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask ,YES );
NSString *documentsDirec = [paths objectAtIndex:0];
NSString *savedPath = [documentsDirec stringByAppendingPathComponent:[NSString stringWithFormat:@"myImages%d.png", i]];
ALAssetRepresentation *rep = [[image objectAtIndex: i] defaultRepresentation];
UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]];
NSData *imageData = UIImagePNGRepresentation(image);
[imageData writeToFile:savedPath atomically:YES];
NSLog(@"saving at:%@",savedPath);
}
How to determine or implement to check if an existing image/imageName is already there. Then if an images exist it will not add the same image/imageName even if its still picked in the picker.
Use the below code for checking a specific image is already exists in the documents directory:
In your code you can add it like this: