cocoacalendareventkitekevent

How Occurrence date of an event is different from the start date?


Both CalEvent and EKEvent represents startDate, endDate and occurrenceDate. But since an event object represents the concrete event, with concrete start and end dates. What is the reason to have an occurrenceDate which is always the same as startDate?

Is there a situation when occurrenceDate does not match the startDate of an event?


Solution

  • From the EKEvent.occurrenceDate documentation:

    This value will remain the same even if the event has been detached and its start date has changed.

    So if you have a recurring event, and you detach an occurrence of that event from it, creating a new, separate event, the new event will have the same occurrenceDate but a different startDate.

    That seems like it's backwards, but it's what I'm getting from that passage in the docs. You can verify this by experiment by creating a new recurring event in Calendar/iCal and then detaching a subsequent occurrence of it, and looking at the detached event's startDate and occurrenceDate with Event Kit.

    I don't know whether this is equally true or the same way around in Calendar Store, whose documentation doesn't describe the difference between the occurrence and startDate properties.