Calendars are out of date

if ([eventStore.calendars count] == 0) { NSLog(@"No calendars are found."); return NO; } EKCalendar *targetCalendar = nil; /* Try to find the calendar that the user asked for */ for (EKCalendar *thisCalendar in eventStore.calendars){ line2 if ([thisCalendar.title isEqualToString:paramCalendarTitle] && thisCalendar.type == paramCalendarType){ targetCalendar = thisCalendar; break; } } 

Line 1 and line 2 receive the error message: "deprecated calendars: the first is deprecated in iOS 6"
How to solve it?

+4
source share
1 answer

Instead, you should use the following method.

 - (NSArray *)calendarsForEntityType:(EKEntityType)entityType; NSArray *cals = [eventStore calendarsForEntityType: EKEntityTypeEvent]; 

And use the cals array in line2.

Check the documentation here

+5
source

All Articles