Reputation: 55
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?
Here is the code I used:
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)
}
}
Upvotes: 1
Views: 1360
Reputation: 7893
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.
And cancelLocalNotification(notification) is a custom method need to be called by one-self.
Upvotes: 1