Search code examples
iosobjective-cekeventstore

Can't retrieve event store calendars?


I have the iCloud calendars and some subscribed calendars on my device, all calendars apps including the native calendar app display the calendars correctly, but in my app i can't retrieve them. I am trying to retrieve the event store calendars as follow:

A)

 NSArray *calendarArray = [self.eventStore calendarsForEntityType:EKEntityTypeEvent];
// always return result an empty array

B)

 NSMutableArray *calendars = [[NSMutableArray alloc]init];
 for (EKSource *source in self.eventStore.sources) {
        NSSet *sourceCalendars = [source calendarsForEntityType:EKEntityTypeEvent];
        [calendars addObjectsFromArray:sourceCalendars.allObjects];
  }
// always return result an empty array

The event store instance is allocated and initialized correctly, and the privacy for accessing calendars also granted.

What can I do ?

Regards


Solution

  • When you have more than 100 calendar and Reminder lists then event store stop working properly.

    For more info check this link: http://support.apple.com/kb/HT4489?viewlocale=en_US