IOS 取消本地通知 [英] IOS Cancelling Local Notifications

查看:43
本文介绍了IOS 取消本地通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不喜欢问含糊不清的问题,但我无法确切说出问题所在.

I dont like asking vague questions but I couldnt exactly tell what the problem is.

在我的应用中,我设置了一些每日本地通知.每天下午200点拍摄.后来我删除了设置本地通知的代码,并添加了推送通知功能.

In my app I set some daily local notifications. Shooting everyday at 200PM. I later removed the codes that sets the local notifications, and added push notification feature.

我测试了推送并且它可以工作(只要我想).但我仍然收到旧的通知,可能是因为我早些时候在手机上的某个地方设置了它们.有没有办法在不编码的情况下取消它们.例如,如果我删除应用程序,它们会被取消吗?

I test the push and it works (whenever I want to). But I still get the old notifications as well, could it be because I set them earlier somewhere on the phone itself. Is there a way to cancel them without coding. For example are they cancelled if I remove the app?

推荐答案

卸载该应用程序将删除本地通知,尽管有些人报告说它们被缓存了长达 24 小时(因此,如果您删除该应用程序,请不要t 重新安装它超过 24 小时)有关详细信息,请参阅此处.

Uninstalling the app will remove the local notifications, although some people have reported that they are cached for up to 24 hours (so if you delete the app, don't reinstall it for more than 24 hours) See here for more details.

否则,如果您仍然可以访问代码,则可以像这样取消所有本地通知:

Otherwise, if you still have access to the code you can cancel all local notifications like this:

[[UIApplication sharedApplication] cancelAllLocalNotifications];

这篇关于IOS 取消本地通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆