Issues with NEHotspotConfigurationManager (unknown & internal errors)

Hello,

I am using apply(_:completionHandler:) on the NEHotspotConfigurationManager.shared to prompt the user to join particular WiFi network.

In my testing it works all the time, but via Sentry I am getting a lot of errors with this code from the NEHotspotConfigurationErrorDomain domain.

In particular I am getting: NEHotspotConfigurationErrorInternal and NEHotspotConfigurationErrorUnknown.

It doens't appear to be connected to particular iOS version nor device.

The WiFi network should be pretty same too - this is an app that connects to the Nintendo Switch game console.

From some anectodal reports it looks like when the user tries to connect via Camera.app (by scanning QR code) that works for the WiFi connection.

It is possible to debug this further?

In particular I am getting: NEHotspotConfigurationErrorInternal and NEHotspotConfigurationErrorUnknown.

This may be that you are trying to communicate with the device directly after association and that is why you are receiving these errors. If so, add a small delay in to allow for the IP and the association to setup correctly.

Also, there have been some issue using the flag for joinOnce in iOS 15. If you are using this flag, take it out and see if the apply / removeConfiguration calls work any better.

Regarding:

It is possible to debug this further?

The best way you can debug this further is by installing the Wi-Fi debug profile on the iOS device, reproduce the issue, and then take a look at the WiFiManager logs. These logs can be seen in the sysdiagnose or in realtime from the Console.app.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Thanks!

This may be that you are trying to communicate with the device directly after association and that is why you are receiving these errors. If so, add a small delay in to allow for the IP and the association to setup correctly.

I am attempting the connection only when the completionHandler gets called, which seems to be as soon as user is done with the system dialog? Meaning they either press "Join" or decline.

Then I have 0.5 second delay before attempting to access data from the game console in this case.

Unless the completionHandler is somehow called multiple times, I have no idea how accessing the device (or trying to) could lead to errors I am seeing?

There is also this one: NEHotspotConfigurationErrorAlreadyAssociated which I would expect to get in cases where I am attempting to join the same network for second time, but I haven't got this one yet.

Also, there have been some issue using the flag for joinOnce in iOS 15

Hmm this possibly be it, as I am indeed using this flag. The majority of devices that report the mentioned erros are various versions of iOS 15, but not all of them. Since disconnect should happen as soon as the game console stops providing network, I think I can safely remove this flag and see if there are any changes.

I am attempting the connection only when the completionHandler gets called, which seems to be as soon as user is done with the system dialog? Meaning they either press "Join" or decline. Then I have 0.5 second delay before attempting to access data from the game console in this case.

A 0.5 second delay is not long enough after the completion handler is run. I have always used at least a 3-5 second delay here after the completion handler is hit. This can be created programmatically, or through natural course of action where your app waits on the user to trigger the actual network connection.

Regarding:

Hmm this possibly be it

If you are using joinOnce and are not able to successfully use the API for removeConfiguration(forSSID:) after the Network Configuration used joinOnce, then please open a bug report for your case and respond back with the Feedback ID.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Thanks for the details!

I had no idea regarding timing. Changed it to 3 seconds + removed the joinOnce flag. I am going to do phased release and will monitor Sentry regarding these issues.

Issues with NEHotspotConfigurationManager (unknown & internal errors)
 
 
Q