I was able to save my array of files in my NSDocumentDirectory.
Here is what I used:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"Images%d.png", i]];
ALAssetRepresentation *rep = [[info objectAtIndex: i] defaultRepresentation];
UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]];
//NSData *imageData = UIImagePNGRepresentation(image);
[UIImageJPEGRepresentation(image, 1.0) writeToFile:savedImagePath atomically:YES];
My problem is how to load images with this format@"Images%d.png" into this code:
.h
@property (strong, nonatomic) NSMutableArray *images;
.m
self.images = ??????
Here is the code to read the image names from bundle. Please modify bundle path to documents directory path. Code snippet will give you array of sorted image names also save you from using a for-loop to read names.
Friendly advice: Avoid storing any downloadable data/images in NSDocumentDirectory directory as app may get rejected. Use NSCachesDirectory instead. Please read this post and related documents on Apple’s developer portal.
Cheers!!
Amar.