0

我认为 AssetLibrary 的 group(album) 枚举 api 在 ios 8.02 上不再起作用, enumerateGroupsWithTypes:usingBlock: 在枚举所有组时不返回最近添加的组,并且在调用 Library 组时返回空(记录为: // The Library包括所有资产的组。)

这是我的代码

+(void)loadCameraRollGroupFromAssetLibrary:(ALAssetsLibrary *)assetLibrary withBlock:(void (^)(BOOL hasPermission, YLCameraRollGroup *cameraRoll))block {
    __block BOOL foundCameraRoll = NO;
    [assetLibrary enumerateGroupsWithTypes:ALAssetsGroupLibrary usingBlock:^(ALAssetsGroup *assetsGroup, BOOL *stop) {
        if(assetsGroup){
            YLCameraRollGroup *group = [[YLCameraRollGroup alloc] initWithAssetsGroup:assetsGroup];
            if(group.isCameraroll){
                NSLog(@"found camera roll");
                *stop = YES; // this fucking stop didn't work, don't know why
                foundCameraRoll = YES;
                block(YES, group);
                return;
            }
        }
        else{
            if(!foundCameraRoll){
                NSLog(@"no camera roll");
                block(NO, nil);
            }
        }
    } failureBlock:^(NSError *error) {
        block(NO, nil);
    }];
}


-(id)initWithAssetsGroup:(ALAssetsGroup *)assetsGroup{
    self = [super init];

    if(self){
        self.name = [assetsGroup valueForProperty:ALAssetsGroupPropertyName];
        NSLog(@"loaded group: %@", self.name);
        self.assetsGroup = assetsGroup;

#if TARGET_IPHONE_SIMULATOR
        self.isCameraroll = [self.name isEqualToString:@"Saved Photos"];
#else
        self.isCameraroll = [self.name isEqualToString:@"Camera Roll"] || [self.name isEqualToString:@"Recently Added"];
#endif
    }

    return self;
}

它发生在其他人身上吗?

4

1 回答 1

1

ALAssetsGroupLibrary:包含从 iTunes 同步的所有资产的库组。

这不是相机胶卷。没有相机的设备的相机胶卷或保存的照片应该在ALAssetsGroupSavedPhotos. Recently Added我认为他们从8.0.2 中恢复了它。

于 2014-09-27T20:06:11.200 回答