您可以使用谓词来指定专辑的名称,并使用它从 collectionList 中获取特定的专辑。
PHFetchOptions *fetchOptions = [PHFetchOptions new];
fetchOptions.predicate = [NSPredicate predicateWithFormat:@"title = %@", ABC];
PHFetchResult *collectionsFetchResult = [PHCollection fetchCollectionsInCollectionList:self.collectionList options:fetchOptions];
PHAssetCollection *ABCAlbum = collectionsResult.firstObject;
NSLog(@"ABC album details: %@", ABCAlbum);
或者您可以将 nil 放入 options 并获取 List 中的所有 AssetCollections。
PHFetchResult *collectionsFR = [PHCollection fetchCollectionsInCollectionList:list options:nil];
if ( collectionsFR.count > 0) {
for ( PHAssetCollection *collection in collectionsFR) {
// do something with each album
NSLog(@"collection is %@", collection);
}
}