如何在iPhone中取消本地通知 [英] how to cancel a local notification in iphone

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

问题描述

我正在制作需要设置通知的应用程序,谢天谢地,我能够设置本地通知,但我不知道如何删除此应用程序设置的通知(我的aplicaton).Xcode确实提供了功能删除与removeAllNotifications,但您无法删除应用程序设置的选定通知

I am making the application that has needs to set the notification , thankfully i was able t set the local notification but i dont know how to delete the notification which is set by this application(my aplicaton ).The xcode does provide functionality of delete with removeAllNotifications but you cannot remove the selected notifications set by the application

推荐答案

您可以致电 [ [UIApplication sharedApplication] cancelLocalNotification:notification] 取消通知。由于本地通知符合 NSCoding 协议,因此可以存储和检索它们以便以后取消。

You can call [[UIApplication sharedApplication] cancelLocalNotification:notification] to cancel a notification. Since local notifications conform to the NSCoding protocol, they can be stored and retrieved for later canceling.

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

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