1

I am sending notifications to my swift application. This works great and hits the didReceiveRemoteNotification method in AppDelegate. Currently when you click the notification received, it goes to a specific view. This works fine but when I kill the app and there is nothing running in background, clicking on notification does not take me to that view. I'm unable to even debug further since I removed the app from the background.

I still want to go to a specific view when clicked on notification when app is not running.

  • What method in app delegate will do this for me?
  • How can I debug in Xcode as when I'm on my phone the app shouldn't be running for testing the code?

Here is my code:

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {

        let id = JSON(userInfo[“id”]!).stringValue

        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let root = application.keyWindow?.rootViewController as! UINavigationController
        let listVC = storyboard.instantiateViewControllerWithIdentifier(“root”) as! ListViewController

            listVC.id = id
            root.pushViewController(listVC as UIViewController, animated: false)
        }
}
fscore
  • 2,567
  • 7
  • 40
  • 74

0 Answers0