Ios - 过滤资产组

时间:2013-08-06 22:53:05

标签: ios filter assets enumerate

我想使用资源的网址作为过滤器参数从资源库中获取一些照片:

ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init];
[assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos
    usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
        if (nil != group) {
            // be sure to filter the group so you only get photos
            [group setAssetsFilter:[ALAssetsFilter allPhotos]];
            [group enumerateAssetsUsingBlock:
            ^(ALAsset *result, NSUInteger index, BOOL *stop) {
                if (nil != result) {
                    ALAssetRepresentation *repr = [result defaultRepresentation];
                    BOOL exists = [...[repr.url absoluteString]];
....

问题是enumerateAssetsUsingBlock块逐个获取所有照片,并且该过程太慢。有没有其他方法来过滤资产组?

由于

0 个答案:

没有答案