Chapter 32. Calendar

The user’s calendar information, which the user sees through the Calendar app, is effectively a database. Starting in iOS 4.0, this database can be accessed directly through the Event Kit framework. You’ll link to EventKit.framework and import <EventKit/EventKit.h>.

A user interface for interacting with the calendar is also provided, by the Event Kit UI framework. This interface basically replicates part of the Calendar app. You’ll link to EventKitUI.framework and import <EventKitUI/EventKitUI.h>.

Calendar Database

The calendar database is accessed as an instance of the EKEventStore class. Starting with this instance, you can obtain two kinds of object:

A calendar
A calendar is a collection of events, usually categorized for some purpose, such as Work or Home. It is an instance of EKCalendar. You can fetch all calendars with the calendars property, or the default calendar with the defaultCalendarForNewEvents property. Calendars have various types (type), reflecting the nature of their origin: a calendar can be created and maintained by the user locally (EKCalendarTypeLocal), but it might also live remotely on the network (EKCalendarTypeCalDAV, EKCalendarTypeExchange), possibly being updated by subscription (EKCalendarTypeSubscription); the Birthday calendar (EKCalendarTypeBirthday) is generated automatically from information in the address book. You can’t create a calendar.
An event
An event is a memorandum describing when something happens. It is an instance ...

Get Programming iOS 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.