1

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)
    }
}
Bista
  • 7,869
  • 3
  • 27
  • 55
  • Don't know the answer. But, I hope this might help you : http://stackoverflow.com/questions/6340664/delete-a-particular-local-notification – Bista Mar 17 '15 at 10:56
  • Thanks for the response....didReceiveLocalNotification is called twice for the same notification...i.e. both when notification is received in notification centre and when received notification is tapped. According to the code I posted, tapViewController should be displayed when I tap the notification.But it is displayed when I pull down notification center(applicationState=Inactive) and notification is received ,even though notification is not tapped. Can u please help me?Thanks in advance – Vedapragnareddy Aramati Mar 19 '15 at 06:39

1 Answers1

1

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.

Bista
  • 7,869
  • 3
  • 27
  • 55