I'm trying to get a list of reminders from a calendar but I'm keep getting an error. I can do a similar thing with calendar events but when i try and amend it for reminders i run into problems.
This code fails on the first line to do with EKEntityMaskReminder
_store = [[EKEventStore alloc] initWithAccessToEntityTypes:EKEntityMaskReminder];
EKCalendar *calendar = [_store calendarWithIdentifier:[self.detailItem valueForKey:@"cal_id"]];
NSArray *calendarArray = [NSArray arrayWithObject:calendar];
NSPredicate *predicate = [_store predicateForRemindersInCalendars:calendarArray];
_eventsList = [_store fetchRemindersMatchingPredicate:predicate completion:nil];
The error message is:
-[EKEventStore initWithAccessToEntityTypes:]: unrecognized selector sent to instance 0x157660
If i change the store thus:
_store = [[EKEventStore alloc] init];
then it fails with:
'-[EKEventStore predicateForRemindersInCalendars:]: unrecognized selector sent to instance 0x165c20'
I am able to create a reminder if i set the store as:
_store = [[EKEventStore alloc] init];
and it shows in the reminders app.
Does anyone know why i can't query these reminders?
Both of the selectors you're getting errors on have availability starting with iOS 6. If you're trying to run your program against something other than the beta OS/libraries, it's going to fail.
(It's extremely odd that initWithAccessToEntityTypes
is recommended in iOS 5.1 documentation, though without a method description.)