NEHotspotConfigurationManager cannot connect

Hi,


We have an IoT with a Wi-Fi server that switch on on demand through BLE command. Process is the following :


1. Device is connected to IoT with BLE

2. Device send request to switch from BLE to WiFi mode

3. IoT start a built in Wi-Fi hotspot configured with same SSID and WPA password

4. Device try to connect using the NetworkExtension framework


Sometime it works but sometine no.


In our use case we never got an error from the NEHotspotConfigurationManager.shared.apply completionHandler. But a system alert pop Impossible to connect network "xxxxxxxx" is shown.


The IoT SSID is visible in check in settings > Wi-Fi network list. Then when selecting manually the IoT SSID network to connect it always connect with success using the exact same password used with NEHotspotConfiguration.


Since we do not receive a proper error we cannot even request the user to maually connect to WiFi network unless we check the SSID network name beign connected on is equal to the IoT SSID network name.


Any help would be very mush appreciated if someone has experienced the same.


Thank you all.


Here is the code we use :


private func connectWifi() {
        guard let ssid = wifi.ssid, let pwd = wifi.pwd else {
            set(.error)
            return
        }
   
        DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2), execute: {
            let hotSpot = NEHotspotConfiguration(ssid: ssid, passphrase: pwd, isWEP: false)
            hotSpot.joinOnce = false
            NEHotspotConfigurationManager.shared.apply(hotSpot, completionHandler: { [weak self] error in
                print("NEHotspotConfigurationManager error > \(String(describing: error))")
                guard error == nil else {
                    self?.set(.error)
                    return
                }
                self?.set(.sync)
            })
        })
    }

Hey!

We are facing the same problem, I have scoured the internet and found no viable solution:

  • Re-wrote the implementation I was using from obj-c to swift
  • Do a SSID check after "applying" the configuration (not a fix, but at least let's me confirm the connection is successful)
  • We tried a device running iOS 15 and it constantly fails, restarting the device does nothing
  • A device running iOS 16 doesn't seem to show this issue (so far...)
  • Somebody on StackOverflow mentioned the only workaround was to join the network manually, then try to join using the API, then forget the network, afterwards the network can be joined again

So, it could be the issue is fixed on iOS 16 but cannot really confirm it so far. I hope to get some confirmation this bug has been fixed.

we are facing the same issue on iOS18.1 in our app to connect our loT . In some case iPhone 13 working well with the same WiFi-network,and the new devices some like iphone 15 pro max/iphone 16 with new os version can not connect. The issue seems to be growing on new systems recently. We have recently received a lot of user feedback regarding similar issues, but as developers, we are unsure what is happening. The error is nil. What can we do for our app users?

NEHotspotConfigurationManager cannot connect
 
 
Q