0

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.

srijansrv
  • 5
  • 2
  • We're seeing a similar issue, did you find a fix? – Ryan Mar 31 '21 at 16:32
  • 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 Jun 14 '21 at 05:44
  • thanks for letting me know. – Ryan Jun 15 '21 at 15:12
  • I'm also seeing this issue, what other ways of communication did the engineers suggest? – monty Aug 23 '22 at 15:19

2 Answers2

0

I m doing this, too.

It seems like certificate problem.

Check this.

Spencer Reid
  • 409
  • 3
  • 14
0

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?

Apsara
  • 61
  • 6