即使在通知被取消之后,也会进行UIL本地通知

通知即使在取消后也会触发。 我试着检查取消方法,结果是正确的。

当我取消通知时,第二天再次发出通知

- (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属性被删除。

所以我想知道我哪里错了。

1)首先检查检索到的特定通知对象不是 。 同时检查是否是您要取消的通知。

2)当你确定通知对象不是 ,并且通知是所需的 ,然后在命令下面触发。 通知是您想要的通知对象。

 [[UIApplication sharedApplication] cancelLocalNotification:notification]; 

3)我正在查看你的代码,我可以看到你没有在你的代码中的任何地方使用bookID通知。 不知道你是否使用该代码了。

4)不,你不需要做任何额外的取消重复通知

注意:请用最终更新的代码更新您的问题。 这看起来很混乱。