When you close the application, your application can still receive silentNotifications or download data in the background .
In the pictures below, red
surrounded when your application is still doing something, but it is no longer displayed on the screen. It is in the background, so AppDelegate no longer needs a window . The result will be set to nil
Simple review

Detailed review

FWIW, the code below will not make the application launch using vc .
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let vc = ViewController() window?.rootViewController = vc window?.makeKeyAndVisible() return true }
Why is this not working? Since the window property is optional, it is initially set to nil. It must be created
The code below will work
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let vc = ViewController() window = UIWindow(frame: UIScreen.main.bounds) // Now it is instantiated!! window?.rootViewController = vc window?.makeKeyAndVisible() return true }
Honey source share