我正在创建一个类似照片应用程序的应用程序。我的应用程序创建相册并捕获图像并将它们保存在照片应用程序的相册中。为此,我正在使用照片框架。当我获取相册时,它会为我提供由我的应用程序以及其他应用程序创建的相册。所以我只想要那些由我的应用程序创建的相册/图像,而不是由其他应用程序创建的。
最佳答案
没有直接的方法可以做到这一点。但这是一种解决方法。
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];
}
}
}
关于ios - iPhone : Photos framework : how to get only those album/images which created by my app only not by others?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28987198/