I am creating an app which should open specific view controller when I tap on UILocalNotification. My code is :
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
if application.applicationState == UIApplicationState.Inactive
{
root.presentViewController(setview, animated:false , completion: nil)
}
}
TapViewController is displayed even if I don't tap on notification when I pull down the notification centre from my app,because the application state is changing from inactive to active when I do so.
So how can I detect whether the notification is tapped in this case? What is the condition to check along with application state?