本文介绍了iOS照片框架:是否可以从“人物”访问照片?智能文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 PHCollectionList 访问 PHAssetCollection 。主要想法是从我的iPhone(iOS 10.2)上的People智能文件夹中获取所有集合(以及内部资产)。要获取 PHCollectionList 我正在使用当前代码:

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);

这可以按预期工作。控制台输出:标题:人物。 list.canContainAssets 返回 list.canContainCollections 返回 YES

然后,我正在尝试从列表中获取资产集合

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 总是返回0但是如果我打开照片应用程序,我会在人物文件夹中看到10个集合。

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?

推荐答案

同步面孔相册是指旧功能(在某些配置中仍然支持):同步功能在iPhoto for OS X(10.10及更早版本)中通过iTunes为iOS设备定义的专辑。其中一张专辑是iPhoto的Faces功能(现代照片'人物功能的精神祖先)。

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).

没有用于访问人物功能创建的专辑的API适用于iOS 10的照片。(Ditto for Moments,场景分类以及iOS 10中的大多数其他照片应用功能。)为了获得此类支持,最好的选择是。

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.

这篇关于iOS照片框架:是否可以从“人物”访问照片?智能文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 09:04