Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

14. Dates, Calendars, and Events > 14.1. Retrieving the List of Calendars

14.1. Retrieving the List of Calendars

Problem

You want to retrieve the list of calendars available on the user’s device before you attempt to insert new events into them.

Solution

Access the calendars array property of an instance of EKEventStore. Each calendar is of type EKCalendar:

- (BOOL)            application:(UIApplication *)application 
  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
  
  EKEventStore *eventStore = [[EKEventStore alloc] init];
  
  /* These are the calendar types an iOS Device can have. Please note
   that the "type" property of an object of type EKCalendar
   is of type EKCalendarType. The values in the "CalendarTypes"
   array reflect the exact same values in the EKCalendarType
   enumeration, but as NSString values */
  NSArray *calendarTypes = [[NSArray alloc] initWithObjects:
                            @"Local",
                            @"CalDAV",
                            @"Exchange",
                            @"Subscription",
                            @"Birthday"....

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial