IOS Cancelling Local Notifications

瘦欲@ 提交于 2019-12-30 06:38:10

问题


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

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?


回答1:


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];


来源:https://stackoverflow.com/questions/18324473/ios-cancelling-local-notifications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!