Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Photos Framework: is it possible to access photos from "People" smart folder?

I'm trying to access PHAssetCollections 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?

like image 705
somedev Avatar asked Dec 22 '16 16:12

somedev


1 Answers

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.

like image 108
rickster Avatar answered Nov 04 '22 22:11

rickster