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: ((any Error) -> Void)? = nil)Parameters
- sceneSession:
The session whose scene you want to activate. Specify
nilwhen 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 Activationrequestoptions.
- errorHandler:
An error handler block to execute if a problem occurs. The method doesn’t 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
Deprecated methods
beginIgnoringInteractionEvents()endIgnoringInteractionEvents()setMinimumBackgroundFetchInterval(_:)scheduleLocalNotification(_:)presentLocalNotificationNow(_:)cancelLocalNotification(_:)cancelAllLocalNotifications()setKeepAliveTimeout(_:handler:)UIMinimumKeepAliveTimeoutclearKeepAliveTimeout()setStatusBarHidden(_:with:)setStatusBarStyle(_:animated:)setStatusBarOrientation(_:animated:)registerUserNotificationSettings(_:)registerForRemoteNotifications(matching:)