[英]iPhone : Photos framework : how to get only those album/images which created by my app only not by others?
我正在創建一個像照片應用程序的應用程序。 我的應用程序創建相冊並捕獲圖像並將其保存在照片應用程序的相冊中。 為此,我正在使用照片框架。 當我獲取相冊時,它會給我由我的應用程序以及其他應用程序創建的相冊。 因此,我只希望那些由我的應用創建的相冊/圖像,而不是其他應用創建的相冊/圖像。
沒有直接的方法可以做到這一點。 但這是一種解決方法。
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];
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.