Hello, we have encountered some issues related to calling WiFi connection APIs in our app. The code is as follows:
let ssid = "some-wifi-ap"
let password = "some-pw"
let config: NEHotspotConfiguration = NEHotspotConfiguration(ssid: ssid, passphrase: password, isWEP: false)
NEHotspotConfigurationManager.shared.apply(config, completionHandler: { (error) in
// do something
})
Question 1:
After calling the NEHotspotConfigurationManager.shared.apply
method, ignoring the time it takes for the user to authorize the WiFi connection, this method takes about 4 to 10 seconds to receive a callback. Sometimes it may take even longer! Why does this method take so long to get a result callback? Are there any ways to reduce the time taken by this method? For example, optimizing the API call or the target WiFi.
Question 2:
After calling the NEHotspotConfigurationManager.shared.apply
method, there is about a 3% to 5% chance of an "Unable to join the network" popup. Then, by calling NEHotspotConfigurationManager.shared.apply
again, in most cases, the WiFi connection is successful. Through some stress testing, we collected some device logs, and by examining the WiFi-related logs, we found two main types of errors that might cause this "Unable to join the network" popup. The errors are as follows:
a. (Scan request failed (-528350142, Family Scan Busy)!)
b. (Error: posting APPLE80211_M_SCAN_DONE with err -536870165)
(__WiFiDeviceManagerForcedAssociationCallback: failed to association error 1)
c、__WiFiDeviceManagerForcedAssociationCallback: failed to association error 2
Could you please explain in more detail the specific reasons for these two errors? We would also like to know what specific situations could cause the "Unable to join the network" popup and whether there are ways to avoid or reduce the frequency of this abnormal condition.
Additionally, the WiFi we are connecting to is an AP hotspot provided by our company's product camera without DNS service
Are there any ways to reduce the time taken by this method?
No.
This API is largely a ‘black box’. You pass the request to join the network over to the API and it runs things from there. There’s no option to say ‘do this faster’, nor is there a good way to get progress.
Could you please explain in more detail the specific reasons for these two errors?
I can’t provide the sort of info that you’re looking for.
In general, my role here at Apple is to help folks use the APIs in our various platform SDKs. In this case, the NEHotspotConfigurationManager
is really simple: You call it, it kicks off the process to join the network. And that part of the equation is obviously working.
If things fail later on, that’s not because you’re calling the API incorrectly, it’s because of an incompatibility between the iOS Wi-Fi subsystem and your Wi-Fi network. The falls outside of DTS’s purview. My advice is that you file a bug so that the iOS Wi-Fi engineering team can investigate.
Please post your bug number, just for the record.
ps Our Bug Reporting > Profiles and Logs page has specific instructions for filing Wi-Fi bugs. Make sure to follow them.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"