After sending an https request, I can not connect to the Wi-Fi network programmatically using NEHotspotConfigurationManager, if I do not make an https request, wifi connect works every time, but if I make an https request, the NEHotspotConfigurationManager gets an error Unable to join the network "ssidName". With all that the error comes nil. Tell me what could be the problem. At least a couple of options, I searched the entire Internet.
After sending an https request, I can not connect to the Wi-Fi network programmatically
If I am interpreting your problem correctly you are sending an HTTPS request in the completion handler for NEHotspotConfigurationManager.apply
and it is failing to associate to the network. If you do not send this request, the association works. What I would recommend here is to delay the send of the HTTPS request and move it out of the completion handler of apply
. That way it gives your device and the access point time to negotiate an IP and establish connectivity. A good rule of thumb that I go by is that once you see the Wi-Fi icon on your device toggle off of the previous network, onto LTE or just plain off in the case of a device with no cellular plan, and then you see the Wi-Fi icon show up again in the status bar, it's time to communicate with the access point. You will notice though that the second Wi-Fi icon does not show up until well after the completion handler for apply
has run though.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com