I'm simply trying to access the photos located in a custom folder called "MyFolder" to my UICollectionView. I can easily get this working with "all photos and videos" with the following code, but I can not figure out how to filter the results to only include my folder name:
PHFetchOptions *allPhotosOptions = [PHFetchOptions new];
allPhotosOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]];
PHFetchResult *videos = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeVideo options:allPhotosOptions];
[videos enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL *stop) {
//add assets to array
}];
I have tried using this:
allPhotosOptions.predicate = [NSPredicate predicateWithFormat:@"title = %@", @"Coached"];
But it does not work. Can someone please help me with this?
Wow. After about 5+ hours of suffering. It was quite simple. Here is the code that works: