I am redirecting my app to specific view controllers on notification click in AppDelegate and for that, I am using setting root view controller method but in my case, open tab bar that base view that is SWRevealViewController with TabbarController of the app and on that present request view controller.
here is what I tried so far:
self.window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let homepage = storyboard.instantiateViewController(withIdentifier: "SWRevealViewController")
self.window?.rootViewController = homepage
let rootView = self.window!.rootViewController
let vc = UIStoryboard.init(name: "Ride", bundle: nil).instantiateViewController(withIdentifier:"payAfterPostRequestViewController") as! payAfterPostRequestViewController
rootView!.present(vc, animated: true, completion: nil)
here is what I get by above code:
*Attempt to present <****.payAfterPostRequestViewController: 0x1078e7600> on whose view is not in the window hierarchy!*
may be is not the best way to do it but is almost how I would solve that madness. first try to set a var in the presented viewController
then proceed as you do but omit the present part
if the presented viewcontroller is not necesary to tho from specific VC then I used this code. for present the vc.
to find the topViewController and then after this line
add this.