从iOS的通知中心取消本地通知会触发什么方法? [英] What method is triggered when local notification is dismissed from notification centre of iOS?
问题描述
我正在尝试创建一个触发本地通知的应用,当点击通知时,应打开特定的viewcontroller
.我使用了didReceiveLocalNotification
方法来显示特定的视图控制器.但是,即使我从通知中心撤消了通知,该特定的视图控制器仍在显示.
I am trying to create an app which fires a local notification and when the notification is tapped, a specific viewcontroller
should be opened. I used didReceiveLocalNotification
method to display a specific view controller. But that specific view controller is being displayed even when I dismiss the notification from notification centre.
我们关闭通知会触发什么方法?
What method is triggered when we dismiss the notification?
这是我使用的代码:
func application(application: UIApplication!,didReceiveLocalNotification notification: UILocalNotification)
{
var root = self.window!.rootViewController as ViewController
let main: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var setview = main.instantiateViewControllerWithIdentifier("destination") as tapViewController
//root.navigationController?.popToViewController(setview, animated: false)
if application.applicationState == UIApplicationState.Inactive
{
root.presentViewController(setview, animated:false , completion: nil)
}
}
推荐答案
据我在网络和Apple文档上寻找您的问题的答案时,没有这样的委托方法可用,该委托方法在取消通知时会触发.
As far as I looked for your question's answer on web and apple docs, there is 'NO' such delegate method available which get triggers when a notification is dismissed.
cancelLocalNotification(notification)是一个需要自己调用的自定义方法.
And cancelLocalNotification(notification) is a custom method need to be called by one-self.
这篇关于从iOS的通知中心取消本地通知会触发什么方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!