取消iPhone中的重复UILocalNotification
我用它来设置Repeat UILocalNotification,我的代码成功运行,但问题是,即使在我删除应用程序时,也会弹出警报,是否有任何方法可以实际取消Repeat UILocalNotification 这是我用来设置1分钟后重复UILocalNotification的代码取消iPhone中的重复UILocalNotification,iphone,objective-c,ios,uilocalnotification,Iphone,Objective C,Ios,Uilocalnotification,我用它来设置Repeat UILocalNotification,我的代码成功运行,但问题是,即使在我删除应用程序时,也会弹出警报,是否有任何方法可以实际取消Repeat UILocalNotification 这是我用来设置1分钟后重复UILocalNotification的代码 - (void)alertSelector:(NSString *)AlertTitle WithFiringTime:(NSDate *)date{ UILocalNotification *localNo
- (void)alertSelector:(NSString *)AlertTitle WithFiringTime:(NSDate *)date{
UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];
if (!localNotification)
return;
[localNotification setFireDate:date];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
NSDictionary *data = [NSDictionary dictionaryWithObject:date forKey:@"payload"];
[localNotification setUserInfo:data];
[localNotification setAlertBody:AlertTitle];
[localNotification setAlertAction:@"View"];
[localNotification setHasAction:YES];
localNotification.repeatInterval = NSMinuteCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}
使用下面的代码,我取消了UILocalNotification,但它取消了所有UILocalNotification,我只想取消在1分钟后弹出的UILocalNotification,重复UILocalNotification
[[UIApplication sharedApplication] cancelAllLocalNotifications];
提前感谢而不是使用cancelAllLocalNotifications,您应该保留希望在将来某个时候取消的通知,并使用cancelNotification:方法
cancelNotification:允许您取消特定的通知,但相当明显的警告是您必须保留要取消的通知对象 我发现我的答案是感谢您的回复@lxt,但取消通知行动:只取消任何特定日期的任何特定通知我想取消重复的uilocalnotifications