Instance Method

application:didDiscardSceneSessions:

Tells the delegate that the user closed one or more of the app's scenes from the app switcher.

Declaration

- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions;

Parameters

application

The singleton app object.

sceneSessions

The session objects associated with the discarded scenes.

Discussion

When the user removes a scene from the app switcher, UIKit calls this method before discarding the scene's associated session object altogether. (UIKit also calls this method to discard scenes that it can no longer display.) If your app is not running, UIKit calls this method the next time your app launches.

Use this method to update your app's data structures and to release any resources associated with the scene. For example, you might use this method to update your app's interface to incorporate the content associated with the scenes.

UIKit calls this method only when dismissing scenes permanently. It doesn't call it when the system disconnects a scene to free up memory. Memory reclamation deletes the scene objects, but preserves the sessions associated with those scenes.

See Also

Configuring and Discarding Scenes

- application:configurationForConnectingSceneSession:options:

Returns the configuration data for UIKit to use when creating a new scene.