1

I am creating a application like photos app. My application creates albums and captures images and saves them in albums in photos app. For this I am using Photos framework. When i am fetching albums it gives me albums which created by my app as well as other apps. So I want only those album/images which created by my app only not by other apps.

MaheshP.
  • 13
  • 7

1 Answers1

1

There is no straight-forward way to do this. But this is a workaround.

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];
                }
            }
        }
jarora
  • 5,384
  • 2
  • 34
  • 46