Local Area Network Privacy checking if access denied

Hi
According to this thread
https://developer.apple.com/forums/thread/663852 , when I want to check if permission was denied I should create NWConection and check status and its unsatisfiedReason property.

It is working when device is connected to the WiFi network where given host with ip address is existing like 192.168.100.1.

But I have two cases when proposed solution is not working for me.

1) Device is connected to Wifi network where there is no host with given ip. Then when i try to create connection with NWConnection then for .waiting status I get

waiting(POSIXErrorCode: Connection refused)
Network.NWPath.UnsatisfiedReason.notAvailable

2) when wifi is disabled and and user is using only gsm when i want to create NWConnection to given address I'm receiving after long time
.waiting(POSIXErrorCode: Operation timed out)
Network.NWPath.UnsatisfiedReason.notAvailable

So it seems like .localNetworkDenied for NWPath.UnsatisfiedReason property is only returned for NWConnection to host that exist in current connected Wifi network.

Can you confirm it?

Basically I want to implement functionality that view is showing for the user that denied access to Local Area Privacy Network and he is connected to any Wifi network or even not connected at all.

Is it possible, please advise?

thanks


to given address I'm receiving after long time
.waiting(POSIXErrorCode: Operation timed out)
Network.NWPath.UnsatisfiedReason.notAvailable

So it seems like .localNetworkDenied for NWPath.UnsatisfiedReason property is only
returned for NWConnection to host that exist in current connected Wifi network.

Regarding GSM, I suspect you mean that you are connected over Cellular, so this error is correct because you are not connected to a local area network but rather a WWAN network.

1) Device is connected to Wifi network where there is no host with given ip. Then when i
try to create connection with NWConnection then for .waiting status I get

waiting(POSIXErrorCode: Connection refused)
Network.NWPath.UnsatisfiedReason.notAvailable

This also looks correct because your device is not able to reach a host on the local area network, even though the address you may be using is within that range, there was no reachable host.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Thank you for the explanation.
Local Area Network Privacy checking if access denied
 
 
Q