I am trying to navigate to the ClassroomViewController once I receive the push notification. I have put a break point, and it hits all the lines, but it does not show the ClassroomViewController. I am wondering what I am missing in my current implementation.
I added identifier on the ClassroomViewController on storyboard.
AppDelegate
public var keyWindow: UIWindow? { return UIApplication.shared.windows.first { $0.isKeyWindow } } Helper Method
private func notificationToNavigate() { guard let appDelegate = UIApplication.shared.delegate as? AppDelegate, let topViewController = appDelegate.keyWindow?.rootViewController else { return } let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let cVC = storyboard.instantiateViewController(withIdentifier:"ClassroomViewController") as! ClassroomViewController topViewController.navigationController?.pushViewController(cVC, animated: true) } https://stackoverflow.com/questions/66757035/navigationcontroller-pushviewcontroller-does-not-show March 23, 2021 at 11:51AM
没有评论:
发表评论