Rep*_*All 6 events calendar fetch ios
当预测设置为获取超过一周的事件时,我收到以下错误:
2014-02-18 22:48:04.540 SimpleEKDemo [5283:1803]从文件系统加载时区数据时出错.这是一个严重的问题.日历数据不保证准确.
我正在使用Apple Developer站点的SimpleEKDemo项目.我确实修改了fetchEvents,如下所示:
// Fetch events
- (NSMutableArray *)fetchEvents
{
//Create the end date components
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
dateComponents.day = -7; //If set to -6 no error
NSDate *startDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents
toDate:[NSDate date]
options:0];
dateComponents.day = 7;
NSDate *endDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents
toDate:startDate
options:0];
// We will only search the default calendar for our events
NSArray *calendarArray = [NSArray arrayWithObject:self.defaultCalendar];
// Create the predicate
NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate
endDate:endDate
calendars:calendarArray];
// Fetch all events that match the predicate
NSMutableArray *events = [NSMutableArray arrayWithArray:[self.eventStore eventsMatchingPredicate:predicate]];
return events;
}
Run Code Online (Sandbox Code Playgroud)
事件正在被正确获取.任何的想法?
| 归档时间: |
|
| 查看次数: |
647 次 |
| 最近记录: |