requestAuthorization(completionHandler:)
Asks the system for access to the user’s focus status.
Declaration
func requestAuthorization(completionHandler: (@Sendable (INFocusStatusAuthorizationStatus) -> Void)? = nil)func requestAuthorization() async -> INFocusStatusAuthorizationStatusParameters
- completionHandler:
The handler block to execute when the authorization status for your app is determined. This block has no return value and takes the following parameter:
- status
The authorization status of your app. For a list of possible values, see Infocusstatusauthorizationstatus.
Discussion
Call this method from your app to request authorization to access the user’s focus status. The first time you make this request, the system prompts the user to grant or deny permission.