Can we read all events at once of iphone calendar in programmatic way?

Discussion in 'iPhone/iPad Programming' started by sampadac, May 10, 2011.

  1. macrumors newbie

    Joined:
    May 10, 2011
    #1
    Hi,

    I want to know that, Can we read all events at once of iphone calendar in programmatic way?

    I know the way by which we can retrive events of known days. Following code retrive the events for current date. But how can I retrive all saved events in iphone calendar ie. not depending on dates?


    NSDate *startDate = [NSDate date];

    // endDate is 1 day = 60*60*24 seconds = 86400 seconds from startDate
    NSDate *endDate = [NSDate dateWithTimeIntervalSinceNow86400*1)];

    // 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 eventsMatchingPredicateredicate];



    Thanks,
    Sampada.
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    The documentation make it reasonably clear that you can't. Of course you can simply use the distantPast and distantFuture NSDates as the start and end date and get everything that way.
     
  3. thread starter macrumors newbie

    Joined:
    May 10, 2011
    #3
    Ok...
    Thanks.
     

Share This Page