Instance Method

requestSceneSessionActivation(_:userActivity:options:errorHandler:)

Asks the system to activate an existing scene, or create a new scene and associate it with your app.

Declaration

func requestSceneSessionActivation(_ sceneSession: UISceneSession?, userActivity: NSUserActivity?, options: UIScene.ActivationRequestOptions?, errorHandler: ((Error) -> Void)? = nil)

Parameters

sceneSession

The session whose scene you want to activate. Specify nil when you want the system to create a new scene for your app.

userActivity

A user activity object to dispatch to the session's scene. Use this object to communicate details about a task you want the scene to perform.

options

Information for the system to use when creating or activating the scene. For information about how to create this object, see UIScene.ActivationRequestOptions.

errorHandler

An error handler block to execute if a problem occurs. The method does not execute this block when it successfully activates the scene. This block has no return value and has the following parameter:

error

The NSError object describing the problem that occurred.

Discussion

Call this method when you want the system to display one of your app's scenes. For example, you might call this method to dispatch work to the scene in the form of an NSUserActivity object. When activating an existing session whose scene is no longer in memory, the system creates a new scene and connects it to your app. Similarly, specifying nil for the sceneSession parameter causes the system to create a new scene and corresponding session.

See Also

Creating, Destroying, and Updating Scenes

func requestSceneSessionRefresh(UISceneSession)

Asks the system to update any system UI associated with the specified scene.