5

I'm looking for a smart way letting the user of my app connect to a WiFi Network. I know how to detect if the device is connected or not. I tried to use URL's to direct the User to the correct prefs Page. Unfortunately this doesn't work anymore. Any suggestions on howto require users to connect to WiFi???

thanks for helping!!!

sensslen
  • 770
  • 8
  • 17

1 Answers1

1

Try using it to access the WiFi settings in iOS 5.1

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];

Try using it to access the WiFi settings in iOS 9

if (&UIApplicationOpenSettingsURLString != NULL) { 
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]]; 
}

Try to add prefs tu URL schemes like stackoverflow.com/a/31253743/3668465 did.


You can use this option for identify a SSID:

iOS >= 4.1 it's possible to obtain SSID of wireless network that device is currenctly connected to.

For this you'd use function CNCopyCurrentNetworkInfo

Details on implemenation: iPhone get SSID without private library


question example -> how to programmatically open the WIFI settings in objective c in iOS9

Community
  • 1
  • 1
  • Unfortunately the solution you suggested for iOS 5.1 stopped working in iOS 5.1. Since this Question is already pretty old, I unfortunately can not use your Solution for iOS 9 anymore. – sensslen Nov 16 '15 at 12:22
  • You tried to use it **"Try to add prefs you URL schemes like http://stackoverflow.com/a/31253743/3668465 did."**. In this way the command **"prefs: root = WIFI"** will return to work perfectly on any iOS version, I even use it that way. You should do exactly what the link proposes, certainly will work. – Helton Fernandes Sampaio Nov 16 '15 at 19:06
  • 1
    Have you tested it with iOS 5.1? I mean in the Link you provided it states that the URL Scheme works again in iOS 9 BUT my Question concerns iOS 5.1. As I said this is an old Question and I won't be able to test it. – sensslen Nov 17 '15 at 07:32
  • Ok I understand. Have you ever even tried the "[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];" ? Because it is an old command might work. – Helton Fernandes Sampaio Nov 17 '15 at 11:32
  • 1
    I have. This stopped working in iOS 5.1 and was working in iOS 5. Please read the other answers of the sackoverflow Reference you provided in the Comments. There people explain that this stopped working in iOS 5.1 and started working again in iOS 8. – sensslen Nov 18 '15 at 07:11
  • =/ I understand. I'm sorry for the inconvenience. I work only with 7.0+, did not know that was discontinued in 5.1. In this case I will not know how to help you. – Helton Fernandes Sampaio Nov 19 '15 at 12:44