在我的UNUserNotificationCenterDelegate
方法中,我想将用户跳转到特定的视图控制器。我可以很容易地从情节提要中获取VC:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "beach")
不过,我现在还不能完全确定如何实际呈现它,因为我没有方便的对象来调用presentViewController。
最佳答案
如果您的根是navigationVC
if let nav = self.window?.rootViewController as? UINavigationController {
nav.pushViewController(vc, animated: true)
}
关于swift - 从UNUserNotificationCenterDelegate提供ViewController,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50354996/