2

I am using predicateForEventsWithStartDate:endDate:calendars to find all the events that happen in a given 24 hour period. I want all events where any part of the event takes place on this day. I'm struggling to handle events that span multiple days - i.e. start at 10pm and finish at 2am the 'next' day.

The predicate query seems to only consider the start dates of calendar events when carrying out the search. It shows me events that started during my specified time (and ended afterwards), but not events that began before the time period, but then leaked into it.

I could just set the start date earlier and then remove events that end before today begins.

The Apple Docs are not particularly insightful:

(NSPredicate *)predicateForEventsWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate calendars:(NSArray *)calendars

 startDate: // The start date of the range of events fetched. 

 endDate: // The end date of the range of events fetched.
Awais Hussain
  • 98
  • 1
  • 2
  • 8

2 Answers2

0

Why don't you identify each event u have created with its identifier and fetch it later on using those identifiers itself. I had to delete some of the set event, I identified them with an identifier and deleted them. See if this link can help.

You can edit the event once you have identified it properly.

Deleting an EKEvent from device's calendar using its identifier

Community
  • 1
  • 1
JgdGuy
  • 173
  • 11