Disclaimer –I’m new to iOS and to this forum too.
I have a need to get pictures taken in specific dates (let’s say January 9-January 12) . I don't want to go over all the photos in the photo library for enhance the app performance. I am looking for some public API to full fill my requirement. Does apple Photo Framework
supports fetching photo collection by date? Is PHFetchOptions
the solution and if so what is the right way to use it ?
Asked
Active
Viewed 1,426 times
4

Wain
- 118,658
- 15
- 128
- 151

Amit Fisher
- 111
- 5
1 Answers
10
You can create a predicate to specify the dates:
PHFetchOptions *fetchOptions = [PHFetchOptions new];
fetchOptions.predicate = [NSPredicate predicateWithFormat:@"creationDate > %@ AND creationDate < %@", startDate, endDate];
PHFetchResult *fetchResult = [PHAsset fetchAssetsWithOptions:fetchOptions];

Wain
- 118,658
- 15
- 128
- 151