我想知道如何以編程方式閱讀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