我正在开发一个提醒到期日期的应用程序。我使用 Uilocanotification
和重复间隔(NSMonthCalendarUnit
、NSDayCalendarUnit
、NSDayCalendarUnit
)实现了相同的功能。
例如。我已于 03/10/2012 设置了本地通知
如果我从 iPad/iPhone 中删除该应用程序。我再次重新安装应用程序,我仍然收到重新安装之前设置的旧通知。删除应用程序时是否可以cancelallNotification
。
最佳答案
我的猜测是,您可以在安装应用程序并运行以下命令时进行一次性检查:
- (void)cancelAllLocalNotifications
即
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if([defaults objectForKey:@"FIRST-TIME-CHECK"] == null){
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[defaults setValue:@"WHATEVER" forKey:@"FIRST-TIME-CHECK"];
}
关于ios - 删除应用后是否可以取消所有通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12390655/