I am trying to remove reminder using NSPredicates but they are not getting removed. My code is:
NSPredicate *predicate = [eventStore predicateForIncompleteRemindersWithDueDateStarting:[datepicker1 date] ending:[datepicker2 date] calendars:nil]
[eventStore fetchRemindersMatchingPredicate:predicate completion:^(NSArray *reminders)
{
for (EKReminder *reminder in reminders) {
[eventStore removeReminder:reminder commit:YES error:nil];
} }];
You should also specify the calendars parameters as
EKEventStore *eventStore = [[EKEventStore alloc] init] ;
NSArray *calendarArray = [NSArray arrayWithObject:[eventStore defaultCalendarForNewEvents]];
NSPredicate *predicate = [eventStore predicateForIncompleteRemindersWithDueDateStarting:[datepicker1 date] ending:[datepicker2 date] calendars:calendarArray]
[eventStore fetchRemindersMatchingPredicate:predicate completion:^(NSArray *reminders)
{
for (EKReminder *reminder in reminders) {
[eventStore removeReminder:reminder commit:YES error:nil];
}
}];
I hope this should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.