I'm trying to access PHAssetCollection
s from PHCollectionList
. The main idea is to fetch all collections (and assets inside) from "People" smart folder on my iPhone (iOS 10.2). To fetch PHCollectionList
I'm using current code:
PHFetchResult *listFetchResult =
[PHCollectionList fetchCollectionListsWithType:PHCollectionListTypeSmartFolder
subtype:PHCollectionListSubtypeSmartFolderFaces
options:nil];
PHCollectionList *list = listFetchResult[0];
NSLog(@"title: %@",list.localizedTitle);
This works as expected. Console output: "title: People". list.canContainAssets
returns NO
and list.canContainCollections
returns YES
.
Then, I'm trying to fetch asset collections from list
:
PHFetchResult *collectionFetchResult =
[PHCollection fetchCollectionsInCollectionList:list options:nil];
collectionFetchResult.count
always returns 0. But if I open Photos app i see 10 collections inside "People" folder.
Is it possible to access collections (and photos inside them) from "People" smart album in Photos app?