I'm connecting MBCalendarKit with Core Data.
This is the code to build a dictionary of events:
for (Task *task in _taskArray)
{
_event = [CKCalendarEvent eventWithTitle:[task valueForKey:@"title"] andDate:[task valueForKey:@"startDate"] andInfo:nil];
[_eventsArray addObject:_event];
}
// Moving events to Dictionary
[_calendarData setObject:_eventsArray forKey:_event.date];
When implementing the method CKCalendarDataSource the outcome is not the desired one. I get all the events in the array for every date in the calendar, as shown below.
- (NSArray *)calendarView:(CKCalendarView *)calendarView eventsForDate:(NSDate *)date {
return _calendarData[_event.date];
}