Search code examples
iphoneioscalendareventkit

iPhone 'Event Kit' - how can I specify additional search filters for a fetch (beyond start/end date)?


re iPhone 'Event Kit':

How can I specify additional search filters (per doco here) for a fetching calendar items, beyond the limited options of just start & end date mentioned in the doco? (e.g. all events occurring on Mondays, or with title matching xxx)

Or is it a given that there are no such capabilities beyond what is available in predicateForEventsWithStartDate:endDate:calendars: , hence you need to bring in all events and then iterate through them yourself?


Solution

  • The documentation has a clear answer to your question. See the notes for the eventsMatchingPredicate: method:

    predicate The search predicate. Must be created with the predicateForEventsWithStartDate:endDate:calendars: method.

    Since that method does not allow you to give any other criteria than the dates and the calendars to search in, those are your options. Everything else must be done by iterating over the search results.