i'm trying to fetch event from a calendar, and i'm doing it using this method:
predicateForEventsWithStartDate:endDate:calendars:
but if i create a start date like this:
NSString *str =@"3/15/1980 9:15 PM";
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"MM/dd/yyyy hh:mm a"];
NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
[formatter setTimeZone:gmt];
NSDate *date = [formatter dateFromString:str];
then i do this:
predicate = [eventStore predicateForEventsWithStartDate:date endDate:endDate calendars: [eventStore calendarsForEntityType:EKEntityTypeEvent]];
NSArray *eventArray = [eventStore eventsMatchingPredicate:predicate];
the eventArray is nil, instead if i use:
[NSDate date]
find me the events from today to the future, instead with the old date don't work, i have tried also other old date, but the array is always nil...
When using predicateForEventsWithStartDate function, it looks like the events returned lies in a time interval of around 4 years (86400*365*4+86400*2). Seems like a bug.