NEHotspotConfigurationManager "internal error" swift

Hi,

I'm working on a IOT Application. We have an IoT with a Wi-Fi server that switch on on demand. Process is the following

1. Device is connected to IoT

2. 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 sometimes No.


In our use case we got an error from the NEHotspotConfigurationManager.shared.apply completionHandler. when we trying to connect network "internal error" 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 get this error all the times. But when we restart my iPhone it works fine it happens randomly I'm not sure why it keep happening sometimes.


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


Thank you all.


Here is my Code.


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 
                guard error == nil else { 

                              print(error)
                    return 
                } 
            }) 
        }) 
    }


Thanks in Advance

Replies

Any updates? I have the same issue - after a while i get internal error and my capabilities are on

I have encounterd this issue quite often on iOS version 12.1.3. Please fix this bug, Apple.


Regards,

Amey Kale