我正在尝试获取用户照片库中所有相册的列表,不包括任何 iCloud 共享相册。这是我到目前为止使用的代码:
PHFetchOptions *userAlbumsOptions = [PHFetchOptions new];
userAlbumsOptions.predicate = [NSPredicate predicateWithFormat:@"estimatedAssetCount > 0"];
userAlbumsOptions.includeAssetSourceTypes = PHAssetSourceTypeUserLibrary;
PHFetchResult *userAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary options:userAlbumsOptions];
for (PHAssetCollection *album in userAlbums) {
[self.albums addObject:album];
}
如果我理解正确,该userAlbumsOptions.includeAssetSourceTypes
属性应该过滤掉 iCloud 共享相册;但是,它们仍然显示在列表中。谁能建议我可能做错了什么?