requestAuthorization()
Requests network-sharing authorization for the specified accessory at initial setup.
Declaration
func requestAuthorization() async throws -> WINetworkSharingController.AuthorizationStateReturn Value
An WINetworkSharingController.AuthorizationState value indicating the authorization level the person selected.
Discussion
Call this method to request that the system ask the person to authorize sharing of Wi-Fi networks to the specified accessory. The person or the system may decline the request.
The person can select from the following sharing modes:
Automatically Share: The system automatically sends new networks to the accessory when the device joins them while the accessory is connected.
Ask Every Time: When the device joins a new network, the system notifies your extension through the Wi-Fi Infrastructure framework. Your extension can then check newShareableNetworkAvailable and call presentAskToShareUI(scanProvider:) to present UI asking the person to share that network.
Don’t Share: The person declines to share Wi-Fi networks with this accessory.
In the “Automatically Share” and “Ask Every Time” sharing modes, the accessory may request to share a nearby network that’s known to the person. Accessories can use this to prompt a person to share a different network if they have trouble connecting to a previously shared network.