修复 AppDelegate window 兼容性
This commit is contained in:
@ -22,12 +22,16 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
window.rootViewController = AppRouter.makeRootViewController()
|
||||
window.makeKeyAndVisible()
|
||||
self.window = window
|
||||
(UIApplication.shared.delegate as? AppDelegate)?.window = window
|
||||
|
||||
registerNotifications()
|
||||
}
|
||||
|
||||
func sceneDidDisconnect(_ scene: UIScene) {
|
||||
NotificationCenter.default.removeObserver(self)
|
||||
if (UIApplication.shared.delegate as? AppDelegate)?.window === window {
|
||||
(UIApplication.shared.delegate as? AppDelegate)?.window = nil
|
||||
}
|
||||
}
|
||||
|
||||
private func registerNotifications() {
|
||||
|
||||
Reference in New Issue
Block a user