December 2012
Intermediate to advanced
834 pages
27h
English
You want to retrieve the list of calendars available on the user’s device before you attempt to insert new events into them.
Access the calendars array
property of an instance of EKEventStore. Each calendar is of type
EKCalendar:
-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{EKEventStore*eventStore=[[EKEventStorealloc]init];/* These are the calendar types an iOS Device can have. Please notethat the "type" property of an object of type EKCalendaris of type EKCalendarType. The values in the "CalendarTypes"array reflect the exact same values in the EKCalendarTypeenumeration, but as NSString values */NSArray*calendarTypes=@[@"Local",@"CalDAV",@"Exchange",@"Subscription",@"Birthday"];/* Go through the calendars one by one */NSUIntegercounter=1;for(EKCalendar*thisCalendarineventStore.calendars){/* The title of the calendar */NSLog(@"Calendar %lu Title = %@",(unsignedlong)counter,thisCalendar.title);/* The type of the calendar */NSLog(@"Calendar %lu Type = %@",(unsignedlong)counter,[calendarTypesobjectAtIndex:thisCalendar.type]);/* The color that is associated with the calendar */NSLog(@"Calendar %lu Color = %@",(unsignedlong)counter,[UIColorcolorWithCGColor:thisCalendar.CGColor]);/* And whether the calendar can be modified or not */if([thisCalendarallowsContentModifications]){NSLog(@"Calendar %lu can be modified." ...
Read now
Unlock full access