Мне бы хотелось узнать, как получить все события из EventStore с помощью EventKit в iOS.
Таким образом, я могу указать все события на сегодняшний день:
- (NSArray *)fetchEventsForToday {
NSDate *startDate = [NSDate date];
// endDate is 1 day = 60*60*24 seconds = 86400 seconds from startDate
NSDate *endDate = [NSDate dateWithTimeIntervalSinceNow:86400];
// Create the predicate. Pass it the default calendar.
NSArray *calendarArray = [NSArray arrayWithObject:defaultCalendar];
NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:calendarArray];
// Fetch all events that match the predicate.
NSArray *events = [self.eventStore eventsMatchingPredicate:predicate];
return events;
}
Правильный должен использовать NSPredicate, который создается с помощью
NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:calendarArray];
Я пробовал использовать
distantPast
distantFuture
как startDate и endDate, ничего хорошего. Таким образом, другие A от других Q не являются безусловными, которые они ищут.
Спасибо!
ИЗМЕНИТЬ
Я протестировал и пришел к выводу, что я могу получать события только за 4 года максимум. Любой способ преодолеть это? Без использования нескольких наборов.