Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sampadac

macrumors newbie
Original poster
May 10, 2011
4
0
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.