Skip to content

Instantly share code, notes, and snippets.

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *libraryStop) {
NSInteger assetCount = [group numberOfAssets];
NSIndexSet *indexes = [NSIndexSet indexSetWithIndex:assetCount-1];
[group enumerateAssetsAtIndexes:indexes options:NSEnumerationReverse usingBlock:^(ALAsset *result, NSUInteger index, BOOL *groupStop) {
if(result){
CGImageRef imageRef = [[result defaultRepresentation] fullResolutionImage];
UIImage *image = [UIImage imageWithCGImage:imageRef]];
// Do stuff with the image.