当预测设置为获取超过一周的事件时,我收到以下错误:
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;
}
正在正确获取事件。有什么想法吗?