Search code examples
iphoneiosekeventekeventstore

Retrieve EKEvent with specific title in EKEventStore


Hello i have saved some EKEvent in a specific calendar on iCloud, i want retrieve some of these EKEvent with a specific title, it's possible? i see that there is this method:

eventsMatchingPredicate

but there is only one predicate:

predicateForEventsWithStartDate:endDate:calendars:

and i want find EKEvent for title, any idea?


Solution

  • I would suggest that you store the ID of the event and then fetch it by using EKEventStore method - (EKEvent *)eventWithIdentifier:(NSString *)identifier

    EDIT: Aha, now I understand your q. Unfortunately the only predicate you can use with EKEventStore is - (NSPredicate *)predicateForEventsWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate calendars:(NSArray *)calendars

    So you have to supply a start date and end date to fetch events between those dates. After you have fetched the events you can filter the events by using NSArray - filteredArrayUsingPredicate: so there you can give it a predicate with the event's title.