iOS 照片框架:是否可以从 "People" 智能文件夹访问照片?
iOS Photos Framework: is it possible to access photos from "People" smart folder?
我正在尝试从 PHCollectionList
访问 PHAssetCollection
s。主要想法是从我的 iPhone (iOS 10.2) 上的 "People" 智能文件夹中获取所有 collections(和里面的资产)。要获取 PHCollectionList
,我使用的是当前代码:
PHFetchResult *listFetchResult =
[PHCollectionList fetchCollectionListsWithType:PHCollectionListTypeSmartFolder
subtype:PHCollectionListSubtypeSmartFolderFaces
options:nil];
PHCollectionList *list = listFetchResult[0];
NSLog(@"title: %@",list.localizedTitle);
这按预期工作。控制台输出:"title: People"。 list.canContainAssets
returns NO
和 list.canContainCollections
returns YES
.
然后,我试图从 list
:
获取资产 collections
PHFetchResult *collectionFetchResult =
[PHCollection fetchCollectionsInCollectionList:list options:nil];
collectionFetchResult.count
总是 returns 0。但是如果我打开照片应用程序,我会在 "People" 文件夹中看到 10 collections。
是否可以从照片应用程序的 "People" 智能相册访问 collections(以及其中的照片)?
"synced Faces" 相册指的是一项较旧的功能(在某些配置中仍受支持):能够将 iPhoto for OS X(10.10 及更早版本)中定义的相册同步到 iOS 设备通过 iTunes。其中一个相册是 iPhoto 的面孔功能(现代照片人物功能的精神祖先)。
没有 API 用于访问 "albums" 由照片中的人物功能为 iOS 10 创建。(同上时刻、场景分类和大多数其他照片应用程序iOS 中的功能 10.) 要游说此类支持,最好的选择是 file bugs.
我正在尝试从 PHCollectionList
访问 PHAssetCollection
s。主要想法是从我的 iPhone (iOS 10.2) 上的 "People" 智能文件夹中获取所有 collections(和里面的资产)。要获取 PHCollectionList
,我使用的是当前代码:
PHFetchResult *listFetchResult =
[PHCollectionList fetchCollectionListsWithType:PHCollectionListTypeSmartFolder
subtype:PHCollectionListSubtypeSmartFolderFaces
options:nil];
PHCollectionList *list = listFetchResult[0];
NSLog(@"title: %@",list.localizedTitle);
这按预期工作。控制台输出:"title: People"。 list.canContainAssets
returns NO
和 list.canContainCollections
returns YES
.
然后,我试图从 list
:
PHFetchResult *collectionFetchResult =
[PHCollection fetchCollectionsInCollectionList:list options:nil];
collectionFetchResult.count
总是 returns 0。但是如果我打开照片应用程序,我会在 "People" 文件夹中看到 10 collections。
是否可以从照片应用程序的 "People" 智能相册访问 collections(以及其中的照片)?
"synced Faces" 相册指的是一项较旧的功能(在某些配置中仍受支持):能够将 iPhoto for OS X(10.10 及更早版本)中定义的相册同步到 iOS 设备通过 iTunes。其中一个相册是 iPhoto 的面孔功能(现代照片人物功能的精神祖先)。
没有 API 用于访问 "albums" 由照片中的人物功能为 iOS 10 创建。(同上时刻、场景分类和大多数其他照片应用程序iOS 中的功能 10.) 要游说此类支持,最好的选择是 file bugs.