I am able to navigate to ChatMessageVC after tapping notification when app is in active state or in background, but when app is in killed state, clicking notification takes me to ContactListVC instead of chatMessageVC. Any help would be highly appreciable.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if let option = launchOptions {
let info = option[UIApplicationLaunchOptionsKey.remoteNotification]
if (info != nil) {
self.application(application, didReceiveRemoteNotification: info as! [AnyHashable : Any])
}
}
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
if state == .background {
let navigation = storyboard.instantiateViewController(withIdentifier: "navigationContactPage")
let navigationController = UINavigationController.init(rootViewController: navigation)
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()
let viewController = storyboard.instantiateViewController(withIdentifier: "chatMessageVC") as! ChatMessagesVC
navigationController.pushViewController(viewController, animated: true)
}
}