0
votes

My iOS app needs to connect to an IOT device Wi-Fi, which does not have internet access. iOS app already knows the ssid password of the iOT device Wi-Fi.

So I tried connecting to IOT device Wi-Fi using [NEHotspotConfigurationManager applyConfiguration] API. The issue is that my app fails to join IOT device Wi-Fi in the first attempt. It connects on second attempt. I have verified that IOT wifi was enabled and availble in Wi-Fi list in Settings > Wi-Fi

In code, error in applyConfiguration callback is nil, indicating success, so I check for connected Wi-FI SSID using CNCopyCurrentNetworkInfo As SSID is different (other network) from my IOT device Wi-Fi SSID, it implies that iPhone is still connected to previosly connected Wi-Fi.

At around the same point, iOS shows the system dialog "Unable to connect to Wifi". I checked for error in system logs while attempting connection, and found that the "wifid" process logs "__WiFiDeviceManagerForcedAssociationCallback: failed to association error 2" for com.apple.SystemConfiguration subsystem

I tried this couple of times, and got this error in console logs everytime connection attempt failed. App is able to connect on subsequent attempts.

2
We're seeing a similar issue, did you find a fix?Ryan
Hi Ryan, we did not find a fix. We had raised TSI on Apple as well, and after several rounds of discussion with them, TSI engineers suggested to use other ways of communication. We faced same issue in the sample app provided by TSI. Some points that TSI had asked to verify was that there were no VPN configurations in your iOS devices that might be hampering the connection, and that the IOT device should acknowledge connection success or failure to iOS device.srijansrv
thanks for letting me know.Ryan

2 Answers

0
votes

I m doing this, too.

It seems like certificate problem.

Check this.

0
votes

The [NEHotspotConfigurationManager applyConfiguration] API does not give a callback but the error. You might try to ping the server repeatedly for a certain timeout. Only if the ping is successful, is the wifi connected. Do you know the ip address of the IOT device?