iosekeventekeventstoreekeventkitekcalendar

predicateForEventsWithStartDate returns nil


predicateForEventsWithStartDate returns nil when the startDate and endDate are same even when there is an event for the dates I am providing, but the same function seems to work if the start and end date are different.

    var predicate:NSPredicate = eventStore.predicateForEventsWithStartDate(fromDate, endDate: toDate, calendars: [defaultCalendar as EKCalendar])       
    var events:[AnyObject]? = eventStore.eventsMatchingPredicate(predicate)

events is nil. I have also checked eventStore is not nil. Thanks for the help


Solution

  • I resolved it, My defaultCalendar was nil, I then assigned this with all the calendar array