You want to add a recurring event to a calendar.
In this example, we are creating an event that occurs on the same day, every month, for an entire year. The steps are as follows:
Create an instance of
Find a modifiable calendar inside the
calendars array of the event store (for
more information, refer to Recipe 14.1).
Create an object of type
EKEvent (for more information, refer to
Set the appropriate values for the event, such as its
endDate (for more information, refer to
Instantiate an object of type
NSDate that contains the exact date when
the recurrence of this event ends. In this example, this date is
one year from today’s date.
recurrenceEndWithEndDate: class method
EKRecurrenceEnd and pass the
NSDate you created in step 5 to
create an object of type
Allocate and then instantiate an object of type
EKRecurrenceRule using the
EKRecurrenceRule. Pass the recurrence
end date that you created in step 6 to the
end parameter of this method. For more
information about this method, please refer to this recipe’s Discussion.
Assign the recurring event that you created in step 7 to the
recurringRule property of the
EKEvent object that was created
in step 3.
saveEvent:span:error: instance method
with the event (created in step 3) as the
saveEvent parameter and the value
EKSpanFutureEvents for the ...