views:

29

answers:

0

Is there a method to receive all entries from calendar at once, without specifying predicate, which can only create 5 years intervals?

I know about "5 years" from console output. I specified 1912-2020 years and here is output: EKEventPredicate start:1/1/12 12:00 AM; end:1/1/16 12:00 AM; cals:(null)

Here is my current code:

EKEventStore *store = [[EKEventStore alloc] init];

NSUInteger beginYear = 1900;
NSUInteger endYear = 2100;

while (beginYear < endYear) {
  NSPredicate *predicate = [store predicateForEventsWithStartDate:[self createDateWithYear:beginYear month:1 day:1] 
                                                          endDate:[self createDateWithYear:beginYear + 5 month:1 day:1] 
                                                        calendars:nil];
  NSArray *eventList = [store eventsMatchingPredicate:predicate];
  for (EKEvent *event in eventList) {           
    [store removeEvent:event span:EKSpanThisEvent error:nil];
  }
  beginYear += 5;
}
[store release];