EKCalendar中的过去事件
我试图从一个确定的EKCalendar
获取所有的事件,但是如果我调用eventsMatching Predicate:
用predicateForEventsWithStartDate生成一个predicateForEventsWithStartDate:endDate:calendars:
和一个过去的' startDate
'我得到一个空对象。 这是一个错误? 或者我无法回顾过去的事情?
编辑(NSData的declarations):
[[self eventStore] predicateForEventsWithStartDate:[NSDate distantPast] endDate:[NSDate distantFuture] calendars:syncedCalendars]
尝试将您的代码更改为:
NSDate* futureDate = [NSDate dateWithTimeIntervalSinceNow:[[NSDate distantFuture] timeIntervalSinceReferenceDate]]; [[self eventStore] predicateForEventsWithStartDate:[NSDate date] endDate: futureDate calendars:syncedCalendars]
还要确保你的syncedCalendars是NSArraytypes。