Class

EKEventStore

An object that accesses the user’s calendar and reminder events and supports the scheduling of new events.

Declaration

@interface EKEventStore : NSObject

Overview

The EKEventStore class is an application’s point of contact for accessing calendar and reminder data.

In iOS, you must request access to an entity type after the event store is initialized with requestAccessToEntityType:completion: for data to return.

In macOS, use initWithAccessToEntityTypes: instead of the default init method. Acceptable entity types are EKEntityMaskEvent for events and EKEntityMaskReminder for reminders.

Create a predicate, or a search query for events, with the predicateForEventsWithStartDate:endDate:calendars: method.

Fetch and process events that match a given predicate with the eventsMatchingPredicate: and enumerateEventsMatchingPredicate:usingBlock: methods.

Save and delete events from the event store with the saveEvent:span:commit:error: and removeEvent:span:commit:error: methods.

Use similar methods to access and manipulate reminders. Reminders are not available in Event Kit before iOS 6.

Topics

Accessing the Event Store

EKAuthorizationStatus

The current authorization status for a specific entity type.

EKEventStoreRequestAccessCompletionHandler

The signature for a block object used for operating on events with the requestAccessToEntityType:completion: method.

EKEventSearchCallback

The signature for a block object used for operating on events with the enumerateEventsMatchingPredicate:usingBlock: method.

- initWithAccessToEntityTypes:

Initializes access to the event store with support for the given entity type.

Deprecated
- requestAccessToEntityType:completion:

Prompts the user to grant or deny access to event or reminder data.

+ authorizationStatusForEntityType:

Returns the authorization status for the given entity type.

eventStoreIdentifier

The unique identifier for the event store.

Saving and Restoring State

- commit:

Commits all unsaved changes to the event store.

- reset

Returns the event store to its saved state.

- refreshSourcesIfNecessary

Pulls new data from remote sources if necessary.

Instance Methods

- calendarItemWithIdentifier:

Returns either the event’s first occurrence or the reminder with the specified identifier.

- calendarItemsWithExternalIdentifier:

Returns either the event’s first occurrences or the reminders with the specified external identifier.

- calendarWithIdentifier:

Returns the calendar with the specified identifier.

- calendarsForEntityType:

Returns an array of calendars that support a given entity type, such as reminders or events.

- cancelFetchRequest:

Cancels the request to fetch reminders.

- defaultCalendarForNewReminders

The calendar that events are added to by default, as specified by user settings.

- enumerateEventsMatchingPredicate:usingBlock:

Finds all events that match a given predicate and calls a given callback for each event found.

- eventWithIdentifier:

Returns the first occurrence of an event with a given identifier.

- eventsMatchingPredicate:

Returns all events that match a given predicate.

- fetchRemindersMatchingPredicate:completion:

Fetches reminders matching a given predicate.

- predicateForCompletedRemindersWithCompletionDateStarting:ending:calendars:

Fetches completed reminders in a set of calendars within an optional range.

- predicateForEventsWithStartDate:endDate:calendars:

Creates and returns a predicate for finding events in the event store that fall within a given date range.

- predicateForIncompleteRemindersWithDueDateStarting:ending:calendars:

Fetches incomplete reminders in a set of calendars within an optional range.

- predicateForRemindersInCalendars:

Fetches all reminders in a set of calendars.

- removeCalendar:commit:error:

Removes a calendar from the event store by either batching or committing the changes.

- removeEvent:span:error:

Removes an event from the event store.

- removeEvent:span:commit:error:

Removes an event or recurring events from the event store by either batching or committing the changes.

- removeReminder:commit:error:

Removes a reminder from the event store by either committing or batching the changes.

- saveCalendar:commit:error:

Saves a calendar to the event store by either committing or batching the changes.

- saveEvent:span:error:

Saves changes to an event permanently.

- saveEvent:span:commit:error:

Saves an event or recurring events to the event store by either batching or committing the changes.

- saveReminder:commit:error:

Saves changes to a reminder by either committing or batching the changes.

- sourceWithIdentifier:

Returns a source with the specified identifier.

Instance Properties

defaultCalendarForNewEvents

The calendar that events are added to by default, as specified by user settings.

sources

Returns an unordered array of source objects.

calendars

The calendars associated with the event store, as an array of EKCalendar objects.

Deprecated

Relationships

Inherits From

See Also

First Steps

Accessing the Event Store

Request access to a user's calendar data through the event store.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software