title: Fetch all events from EventStore EventKit iOS
body: <p>i would like to know how to fetch all events from an EventStore using EventKit in iOS.</p>
  
  <p>This way i can specify all events for today:</p>
  
  <pre><code>- (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;
  }
  </code></pre>
  
  <p>The correct should use a NSPredicate, which is created with:</p>
  
  <pre><code>NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:calendarArray]; 
  </code></pre>
  
  <p>I have tried using </p>
  
  <pre><code>distantPast
  distantFuture
  </code></pre>
  
  <p>as startDate and endDate, no good.
  So other A's from other Q's are not exaclty wha im looking for.</p>
  
  <p>Thank you!</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have tested and got to the conclusion that i can only fetch events in a period of 4 years maximum. Any way of getting past this? Without using multiple fetches.. </p>