1
votes

I'm building an app that has some iOS calendar functionality built into it. The user can create events and send them to their iCal, but I only want events created in my app to show on the calendar in the app.

I know I can use predicates like below:

NSPredicate *predicate = [_eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:preferredAppleCalendars];
NSArray *appleEventsArray = [_eventStore eventsMatchingPredicate:predicate];

But I also have an array of eventIdentifiers that I would like to add as a condition. So, I want events from the eventstore as above, but only if the event matches an event identifier in my array. Is that possible?

1

1 Answers

2
votes

Instead of actually fetching all the events into an array with eventsMatchingPredicate, call enumerateEventsMatchingPredicate. This allows you to filter out further the results, keeping only the ones you like. Remember to get onto a background thread first!