即使在取消后通知也会触发。我尝试检查取消方法,结果证明是正确的。
当我取消通知时,第二天会再次触发通知
- (void)cancelNotification:(int)bookID
{
NSArray *notifications = [[UIApplication sharedApplication] scheduledLocalNotifications];
NSLog(@"Cancelling... Before %d",[[[UIApplication sharedApplication]scheduledLocalNotifications]count]);
for (UILocalNotification *notification in notifications)
{
int notifRemedyId = [[notification.userInfo objectForKey:@"kRemindMeNotificationRemedyIDKey"]intValue];
NSLog(@"remedyID : %d",remedyId);
NSLog(@"notifyId : %d",notifRemedyId);
if (remedyId == notifRemedyId)
{
[[UIApplication sharedApplication] cancelLocalNotification:notification];
}
}
}
我认为它是因为 repeatInterval.should repeatInterval 属性被删除。
所以我想知道我哪里出错了。