I'm trying to fetch a list of all the albums in the user's photo library excluding any iCloud shared albums. Here is the code I am using so far:
PHFetchOptions *userAlbumsOptions = [PHFetchOptions new];
userAlbumsOptions.predicate = [NSPredicate predicateWithFormat:@"estimatedAssetCount > 0"];
userAlbumsOptions.includeAssetSourceTypes = PHAssetSourceTypeUserLibrary;
PHFetchResult *userAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary options:userAlbumsOptions];
for (PHAssetCollection *album in userAlbums) {
[self.albums addObject:album];
}
If I have understood correctly, the userAlbumsOptions.includeAssetSourceTypes property should filter out iCloud shared albums; however, they are still showing in the list. Can anyone suggest what I might be doing wrong?
One possible solution:
Basically, retrieve all asset collections, but only add them to the array of albums if the subtype is not
PHAssetCollectionSubtypeAlbumCloudShared. This works, but I'm not happy with it. ThePHAssetCollectionSubtypeAlbumCloudSharedcheck should not be necessary.