ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
if(group != nil) {
[group setAssetsFilter:[ALAssetsFilter allPhotos]];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
if (result) {
//获取得到的图片
UIImage *image = [[UIImage alloc] initWithCGImage:[result thumbnail]];
NSLog(@"%@",[result valueForProperty:ALAssetPropertyDate]);
}
}];
});
} else {
}
} failureBlock:^(NSError *error) {
NSLog(@"is an error");
}];