Post

Replies

Boosts

Views

Activity

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 BLE2. Device send request to switch from BLE to WiFi mode3. IoT start a built in Wi-Fi hotspot configured with same SSID and WPA password4. Device try to connect using the NetworkExtension frameworkSometime 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) }) }) }
26
1
15k
Feb ’18