我想从所有日历(家庭、工作、日历和生日)中获取事件。我正在从默认日历获取事件,但无法从生日日历获取事件。任何帮助都是最好的。
发布于 2013-09-03 14:20:04
This answer可能会对您有所帮助:
NSDate* endDate = [NSDate dateWithTimeIntervalSinceNow:[[NSDate distantFuture] timeIntervalSinceReferenceDate]];
NSArray *calendarArray = [NSArray arrayWithObject:cal];
NSPredicate *fetchCalendarEvents = [eventStore predicateForEventsWithStartDate:[NSDate date] endDate:endDate calendars:calendarArray];
NSArray *eventList = [eventStore eventsMatchingPredicate:fetchCalendarEvents];
for(int i=0; i < eventList.count; i++){
NSLog(@"Event Title:%@", [[eventList objectAtIndex:i] title]);
}
https://stackoverflow.com/questions/14826011
复制