1

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

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 块一张一张地获取所有照片,这个过程太慢了。有没有其他方法可以过滤资产组?

谢谢

4

0 回答 0