EKEvent Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/EventKit.framework
Availability
Available in OS X v10.8 and later.
Companion guide
Declared in
EKEvent.h

Overview

An instance of the EKEvent class represents an event added to a calendar in the Event Kit framework.

Use the eventWithEventStore: method to create a new event. Use the properties in the class to get and modify certain information about an event. Other properties, such as the event’s title and calendar, are inherited from the parent class EKCalendarItem.

Tasks

Creating Events

Accessing Event Properties

Comparing Events

Refreshing Event Data

Properties

allDay

A Boolean value that indicates whether the event is an all-day event.

@property(nonatomic, getter=isAllDay) BOOL allDay
Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

availability

The availability setting for the event.

@property(nonatomic) EKEventAvailability availability
Discussion

This setting is used by CalDAV and Exchange servers to indicate how the event should be treated for scheduling purposes.

If the event’s calendar does not support availability settings, this property’s value is EKEventAvailabilityNotSupported.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

birthdayPersonUniqueID

The Address Book framework record identifier of the person for this birthday event. (read-only)

@property(nonatomic, readonly) NSString *birthdayPersonUniqueID
Discussion

This property is only set if this is a birthday event; otherwise the property is nil.

Special Considerations
Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

endDate

The end date for the event.

@property(nonatomic, copy) NSDate *endDate
Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

eventIdentifier

A unique identifier for the event. (read-only)

@property(nonatomic, readonly) NSString *eventIdentifier
Discussion

You can use this identifier to look up an event with the EKEventStore method eventWithIdentifier:.

If the calendar of an event changes, its identifier most likely changes as well.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

isDetached

A Boolean value that indicates whether an event is a detached instance of a repeating event. (read-only)

@property(nonatomic, readonly) BOOL isDetached
Discussion

This value is YES if and only if the event is part of a repeating event and one or more of its attributes have been modified from the repeating event’s default attributes.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

occurrenceDate

The original occurrence date of an event if it is part of a recurring series. (read-only)

@property(nonatomic, readonly) NSDate *occurrenceDate
Discussion

This value will remain the same even if the event has been detached and its start date has changed. Floating events (such as all-day events) are returned in the default time zone.

Special Considerations

This property is not available on iOS.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

organizer

The organizer associated with the event. (read-only)

@property(nonatomic, readonly) EKParticipant *organizer
Discussion

This property is nil if the event has no organizer.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

startDate

The start date of the event.

@property(nonatomic, copy) NSDate *startDate
Discussion

Floating events such as all-day events are returned in the default time zone.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

status

The status of the event. (read-only)

@property(nonatomic, readonly) EKEventStatus status
Discussion

You should act based on an event’s status only if the status is EKEventStatusCanceled, which indicates that the event has been canceled. Other statuses should be considered informational.

Availability
  • Available in OS X v10.8 and later.
See Also
Declared In
EKEvent.h

Class Methods

eventWithEventStore:

Creates and returns a new event belonging to a specified event store.

+ (EKEvent *)eventWithEventStore:(EKEventStore *)eventStore
Parameters
eventStore

The event store to which the event belongs.

Return Value

The created event.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

Instance Methods

compareStartDateWithEvent:

Compares the start date of the receiving event with the start date of another event.

- (NSComparisonResult)compareStartDateWithEvent:(EKEvent *)other
Parameters
other

The event to compare against.

Return Value
Discussion

You can pass the selector for this method to the NSArray method sortedArrayUsingSelector: to create an array of events sorted by start date.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

refresh

Updates the event’s data with the current information in the Calendar database.

- (BOOL)refresh
Return Value

If the event was successfully refreshed, YES; otherwise, NO.

Discussion

You should call this method only on events that your application is editing, and only when your application receives the EKEventStoreChangedNotification notification. If this method returns NO, the event has been deleted or otherwise invalidated, and you should not continue to use it.

This method does not replace the values of any properties that you have modified.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

Constants

EKEventAvailability

The event’s availability setting for scheduling purposes.

typedef enum {
   EKEventAvailabilityNotSupported = -1,
   EKEventAvailabilityBusy = 0,
   EKEventAvailabilityFree,
   EKEventAvailabilityTentative,
   EKEventAvailabilityUnavailable
} EKEventAvailability;
Constants
EKEventAvailabilityNotSupported

Availability settings are not supported by the event’s calendar.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

EKEventAvailabilityBusy

The event has a busy availability setting.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

EKEventAvailabilityFree

The event has a free availability setting.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

EKEventAvailabilityTentative

The event has a tentative availability setting.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

EKEventAvailabilityUnavailable

The event has an unavailable availability setting.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h

EKEventStatus

The event’s status.

typedef enum {
   EKEventStatusNone = 0,
   EKEventStatusConfirmed,
   EKEventStatusTentative,
   EKEventStatusCanceled,
} EKEventStatus;
Constants
EKEventStatusNone

The event has no status.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

EKEventStatusConfirmed

The event is confirmed.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

EKEventStatusTentative

The event is tentative.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

EKEventStatusCanceled

The event is canceled.

Available in OS X v10.8 and later.

Declared in EKEvent.h.

Availability
  • Available in OS X v10.8 and later.
Declared In
EKEvent.h