Skip to content

Instantly share code, notes, and snippets.

@sgoodwin
Created February 26, 2014 10:17
Show Gist options
  • Save sgoodwin/9227109 to your computer and use it in GitHub Desktop.
Save sgoodwin/9227109 to your computer and use it in GitHub Desktop.
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.
}
}];
} failureBlock:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment