我想知道如何以编程方式阅读iPhone日历中的所有事件?如何从iPhone日历中检索所有事件?
我知道我们可以检索已知日子事件的方式。以下代码检索当前日期的事件。但我怎么能检索iPhone日历中的所有保存的事件,即。不依赖日期?
NSDate *startDate = [NSDate date];
// endDate is 1 day = 60*60*24 seconds = 86400 seconds from startDate
NSDate *endDate = [NSDate dateWithTimeIntervalSinceNow:(86400*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];
有你做到这一点? – 2011-08-14 19:31:12