NEHotspotConfigurationManager error problem when the wifi not exist

503 Views Asked by At

I found a problem when i try to connect a non-existent wifi, this is my code:

let configuration = NEHotspotConfiguration.init(ssid: "wifi-name")  
 NEHotspotConfigurationManager.shared.apply(configuration) { [unowned self] (error) in  
       print("NEHotspotConfigurationManager.error: \(error)")  
   }

if the wifi dosen't exist, i see and dialog with

"impossible to connect network "wifi-nam""

But the error in the NEHotspotConfigurationManager is nil, so how can control if a specific ssid wifi exists?

1

There are 1 best solutions below

0
On

The unfortunate answer is: You can not control if a specific WiFi exists.

This is the intended behaviour. If you could check if a certain wifi is nearby, you could track a user with that information. This is why android asks for location permissions if you want to do this. On iOS this is currently simply not possible.