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?
The "synced Faces" album refers to an older feature (which is still supported in some configurations): the ability to sync albums defined in iPhoto for OS X (10.10 and earlier) to an iOS device through iTunes. One of those albums is iPhoto's Faces feature (the spiritual ancestor of modern Photos' People feature).
There is no API for accessing "albums" created by the People feature in Photos for iOS 10. (Ditto for Moments, scene classification, and most of the other Photos app features in iOS 10.) To lobby for such support, your best bet is to file bugs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With