I need to get ssid of currently connected network. The reason I need this is to enable my app to perform certain functions when connected to a specific network. Now I cant seem to figure it out as in how to get the ssid? I've read online and implemented following things.
-> Allowed user location
-> Logged in to Apple dev account and enabled Wifi access.
The function I am using is
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
if status == .authorizedAlways || status == .authorizedAlways {
NEHotspotNetwork.fetchCurrent { hotspotNetwork in
if let ssid = hotspotNetwork?.ssid {
print("SSID is \(ssid)")
}
}
}
}
But it is giving the following error
NEHotspotNetwork nehelper sent invalid result code [5] for Wi-Fi information request
What else am I missing here? Do i need to add anything else? Appreciate any help!