I'm able to successfully connect to our IOT device's hotspot using NEHotspotConfiguration, however we need to be able to disconnect from the hotspot when they cancel the setup process.
Calling NEHotspotConfigurationManager.shared.removeConfiguration() only removes the config, but if the phone is currently connected to the hotspot this call has no effect and the device remains connected.
How can I disconnect from this hotspot? Seems like it should be simple!
I'm seeing the same behavior in iOS 15.2 when connecting to my IoT device: invoking removeConfiguration(forSSID:) does not disconnect an hotspot previously connected with joinOnce = true.
This is contrary to Apple's own documentation on joinOnce, which says:
To disconnect the device from a hotspot configured with joinOnce set to true, call removeConfiguration(forSSID:)
So, it seems to be a bug in either: a) iOS 15.2, or b) Apple's documentation. I created a bug report here: https://feedbackassistant.apple.com/feedback/9954367, and I will reply when I hear back from them.
I also see this issue was discussed for earlier iOS versions (12.2, 12.3.1) in this developer forum thread without any resolution.