Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 385
Walter Martin Vargas-Pena Avatar asked Nov 29 '11 15:11

Walter Martin Vargas-Pena


2 Answers

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]];

like image 56
Norman G Avatar answered Oct 21 '22 07:10

Norman G


Seems it is not necessary to populate the NSSet, just alloc-init it (in EKCalendarChooser's viewDidLoad): EKCalendarChooser multiple selection does not work

like image 39
ercolemtar Avatar answered Oct 21 '22 06:10

ercolemtar