Search code examples
iosobjective-cekeventkit

Why is the selectedCalendars property of EKCalendarChooser null?


I have a EKCalendarChoosere which allows me to select calendars. I see the calendars and the delegate methods (EKCalendarChooserDelegate) get called. However when I access the selected calendars property of the calendar chooser they are always null. Does one need to manually add them or does the chooser handle that? Thanks in advance


Solution

  • If you still are interested in why the calendarChooserSelectionDidChange method returns a NULL result for selectedCalendars. I was having the same issue.

    When calendarChooserSelectionDidChange delegate method gets called, if the EKCalendarChooser is setup using EKCalendarChooserSelectionStyleSingle everything works perfectly. But if it's setup for EKCalendarChooserSelectionStyleMultiple, the calendarChooserSelectionDidChange delegate method fires, but the calendarChooser.selectedCalendars will return NULL, unless you set the NSSet of calendars for the EKCalendarChooser when setting it up i.e.: detailViewController.selectedCalendars = mySelectedCalendars; or detailViewController.selectedCalendars = [NSSet setWithArray:[eventStore calendars]];