I’ve made a NSMutableArray for the EKCalendars that my application uses. On the first launch I import all the calendars from the EventStore but I exclude the Birthdays calendar and the default Calendar, leaving only the user created calendars. However the problem is if there is only Birthdays calendar and the default Calendar. Heres what i’ve got so far…
for (int i = 0; i < theEventStore.calendars.count; i++)
{
EKCalendar *c = [theEventStore.calendars objectAtIndex:i];
if (c.type != EKCalendarTypeBirthday && c.type != EKCalendarTypeSubscription)
{
if (c.type == EKCalendarTypeLocal && [c.title isEqualToString:@"Calendar"])
{
NSLog(@"Removed Calendar: %@", c);
}
else
{
[self.calendarLst addObject:c];
NSLog(@"Added Calendar: %@", c);
}
}
}
I’m a little stumped. Any help would be appreciated.
I’ve added this after the original for loop. This ensures that there is something in the array.
The problem was not for loop it was the empty array.