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)
            })
        })
    }
Post not yet marked as solved Up vote post of RequestLab Down vote post of RequestLab
14k views

Replies

Thanks for the information.

Have to addmit that it is a bit of a shame that we cant see any details or at least any status expect closed or open.
Thanks.

So i got notified that the bug is closed, but how should i know what is the solution that the developers came with?

Would appreciate your help.

So i got notified that the bug is closed, but how should i know what is the solution that the developers came with?

If I understand things correctly then your bug was closed as a dup of 42919071. If so, please see this thread, which has a very recent update.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Great update , yet how can i know what is the fix? and how you fixed it?

In iOS 12.2 beta we made changes that we believe address this problem (r. 42919071). I recommend that you re-test your code on the latest seed to see if it works reliably there.

how can i know what is the fix?

This was a change to the OS itself.

and how you fixed it?

I’m not sure what you’re getting at here. We made this change the same way we make any other OS change.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I am getting into understand how was it fixed...
The whole bug confidentiality is ridiculous.
If you fixed the bug tell me how you did it so i can see if it will break my app.
I dont understand why i cant see the bug report

Hi eskimo,


My project requirement is to "Force the iOS device to join a specific Wi-Fi network (SSID and password of WIFI network is known) that’s being published by some other hardware?


To do this I have written below code:


let config = NEHotspotConfiguration(ssid: "strSSID", passphrase: "strPassword", isWEP: false)

config.joinOnce = true

NEHotspotConfigurationManager.shared.apply(config) { (error) in

if error != nil {

print(error!.localizedDescription)

callBack(false)

}

else {

print(String(format:"Successfully connected to the Wi-Fi %@",strSSID))

callBack(true)

}

}


I have to import NetworkExtension framework to execute above code.

Do I need to get the special entitlement permission from Apple to publish my application to the AppStore?

Please respond.


Regards,

Nagraj Wadgire

I still see this behavior on my iPhone XR running 12.3.1

Any fix for this? This behavior still exists for me on iOS 14.4.2 / Xcode 12.5

Very frustrating!

Any fix for this? This behavior still exists for me on iOS 15 / Xcode 12.4

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.