iPhone:照片框架:如何只获取由我的应用程序创build的相册/图像而不是其他人?

我正在创build像照片应用程序的应用程序。 我的应用程序创build相册并捕获图像,并将其保存在照片应用程序中的相册中。 为此,我正在使用Photos框架。 当我提取相册时,会给我提供由我的应用程序以及其他应用程序创build的相册。 所以我只想要那些由我的应用程序创build的专辑/图片,而不是其他应用程序。

没有直接的方法来做到这一点。 但是这是一个解决方法。

PHFetchResult *topLevelUserCollections = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:nil]; self.collectionsFetchResults = @[topLevelUserCollections]; for (PHFetchResult *fetchResult in self.collectionsFetchResults) { for (PHAssetCollection *assetCollection in fetchResult) { BOOL shouldShowCollection = NO; if ([assetCollection.localizedTitle isEqualToString:@"YOUR_APP_NAME"]) { shouldShowCollection = YES; } if (shouldShowCollection) { //collectionsToShow are the collections that you will show up in your table view [self.collectionsToShow addObject:assetCollection]; } } }