Hey,
I'm currently developing an app that uses NEHotspotConfigurationManager to connect to and disconnect from a WiFi network based on user actions. I'm using the following code to connect and disconnect:
Connect
let configuration = NEHotspotConfiguration(ssid: ssid, passphrase: password, isWEP: false)
configuration.joinOnce = true
NEHotspotConfigurationManager.shared.apply(configuration) { (error) in
if let error = error {
print("Error connecting to WiFi network: \(error.localizedDescription)")
} else {
self.lastSSID = ssid
}
}
Disconnect
NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: self.lastSSID)
The issue I'm encountering is that the app successfully connects to the WiFi network and disconnects properly the first time. However, after connecting again, the second disconnect attempt fails to disconnect from the WiFi network.
I found a similar bug report from 2020 that mentioned this issue. The suggested workaround involved setting joinOnce = false, which is not suitable for my app's requirements.
I just checked on the status of the bug mentioned in that thread (r. 87448319) and it hasn’t been fixed. Given that, and the fact that you must use joinOnce
, I don’t see any workaround here )-:
I recommend that you file your own bug about this, asking that it be marked as a duplicate of the above. That way you’ll be notified if we make any progress on the bug.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"