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)
            })
        })
    }

If you insert a few seconds delay between steps 3 and 4, do you still see the same problem.

Share and Enjoy

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

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

Hi,


The original code has a delay of 2 seconds between step 3 and step 4. I have increase to 4 seconds as a test case :


First time i got connected with no issue

Second test failed with the same system UIAlert.


So delay seems not to be the problem. More over why don't we get an error for the connection in the NEHotspotConfigurationManager.shared.apply callback ? Is it the normal behavior or a known bug in the framework ?


Regards,

Hi,


I have made a sample project to connect either on our IoT or on our office wi-fi network.


In case of office network absolutely no issue

In case of our IoT network we still have the described behavior.


So problem looks more on our IoT firmware side than NetworkExtension.


Regards

Is it the normal behavior or a known bug in the framework ?

Do I have to choose (-: Seriously though, the errors that you see via the completion handler are those errors related to the framework itself. Once the request has made it past the Network Extension framework, down to the Wi-Fi subsystem, errors are displayed to the user rather than delivered to your completion handler. Whether that’s a bug is up for debate. Regardless, if it’s causing you problems you should file a bug report describing that impact.

Please post your bug number, just for the record.

So problem looks more on our IoT firmware side than NetworkExtension.

OK. At this point you’re straying outside of my area of expertise. DTS does not, in general, support Apple’s on-the-wire implementation of standard networking protocols. You have a couple of choices here:

  • You can escalate this to Apple via a bug report (A)

  • You can have the folks responsible for your accessory’s firmware investigate it (B)

In case A you should make sure to include a Wi-Fi log, per the instructions on our Bug Reporting > Profiles and Logs page. Come to think of it, that log might be useful in case B too, although I suspect your firmware folks have their own tools for investigating issues like this.

Regardless, it’s very unlikely you’re going to be able to work around this at the API level.

Share and Enjoy

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

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

I have the sane issue - and it is a bug in the Apple software - which clearly states that the completion handler should return the result of attempting to join the Wifi network. In fact it always returns an Error that is nil. This is interpreted as the Network was joined successfully.

I can put any SSID in and still get a nil Error. Any chance of this being fixed?

When the system show the dialog "Impossible to connect network "***"", i don't receive any error form the method:

  NEHotspotConfigurationManager.shared.apply(hotSpot, completionHandler: { [weak self] error in  
 print("NEHotspotConfigurationManager error > \(String(describing: error))")  
 }) 

so the error is nil. There is a listener where the system can inform the app? or it is bug?

Thank

aps_man wrote:

Any chance of this being fixed?

FabioB wrote:

i don't receive any error form the method:

I’ve got nothing to say here beyond what I said on 13 Feb. The fact that errors from the Wi-Fi subsystem don’t get reported via the completion handler is expected behaviour. If you don’t like that behaviour — and, to be clear, I personally agree with you about that — the best way forward is to file a bug report requesting that it be changed. Please post your bug number, just for the record.

There is a listener where the system can inform the app?

Not really. One option is to poll the current SSID (using

CNCopyCurrentNetworkInfo
) to see if you actually make it on to the target network. This is less than ideal, hence my comments above.

Share and Enjoy

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

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

Is there any update on the bug?
How can i see if it is resolved?

Is there any update on the bug?

Which bug? This thread has covered two issues:

  • The unexpected behaviour of the

    NEHotspotConfigurationManager
    completion handler.
  • Intermittent Wi-Fi connectivity problems with one specific Wi-Fi network.

[I’d quote bug numbers here but nobody on this thread has filed a bug about either of these things yet, or perhaps they have but haven’t posted their bug number.]

Share and Enjoy

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

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

Ok , sorry , didnt see it.
I am talking about the nil error while i get alert that says to the user:"Unable to join network SomeSSID".
The "internal error" that requires the restart on the iphone is tolerable.
p.s
I think i have posted a bug(46579891)

With regards the error reporting problem, you wrote:

i have posted a bug(46579891)

Thanks for that.

Is there any update on the bug?

No.

Share and Enjoy

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

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

Hi eskimo,

So my 2 bugs (46628017 and 46579891) regarding the NEHotspot marked as duplicated of 42919071 but i cant seem to find this bug.
How can i see the original bug in order to follow it?

Radar only lets you get detailed status on bug that you filed yourself (one of the reasons that DTS asks folks to file their own bug reports). However, if your bug is closed as a duplicate of another bug, you can see the open/closed status of the original.

Share and Enjoy

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

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

Yes , i understood that but the reason i am asking is because i cant find the bug mentioned (original one "DUPLICATE OF 42919071") in the radar.

I’m not sure I’m parsing your latest post correctly but I think you’re asking how to see the status of the original bug. To be clear:

  • You can’t see any details of the original bug.

  • The only thing you can see is the open/closed status.

To see this:

  1. Open Bug Reporter.

  2. Select your bug on the left.

  3. On the right, at the top, you’ll see a layout like this:

    nnn
    ttttttttttttttttttttttttttttttttttt
    Created on ddd in ccc                   DUPLICATE OF *** sss

    where:

    • nnn
      is your bug number
    • ttttttttttttttttttttttttttttttttttt
      is your bug’s title
    • ddd
      is your bug’s creation date
    • ccc
      is your bug’s component
    • ***
      is the bug number of the original
    • sss
      is the status of the original, either Open on Closed

Clear?

Share and Enjoy

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

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

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

NEHotspotConfigurationManager cannot connect
 
 
Q