我一整天都在搜索如何在appdelegate中展示一个视图控制器。在xcode 11中,window属性被移动到了scenedelegate中,这让我感到困惑。我想在didReceiveRemoteNotification函数中从appdelegate中展示一个视图控制器,所以当用户收到通知时,它会带他们到一个单独的视图控制器中查看信息。我尝试过:
self.window?.rootViewController?.present(LoginViewController(), animated: false, completion: nil)
在我的以前的应用程序中,这个在appdelegate中工作过,但现在似乎不起作用了。任何帮助将不胜感激。
UIApplication
对象获取connectedScenes
。您需要选择一个以显示新的视图控制器。 - Paulw11