5

I found some private (undocumented) APIs but Apple does not allow apps to use private frameworks. So does anyone know how to do this using Apple official packages?

like: when youtube app prompts you to the push notification: "Select a Wi-fi network"

Thanks in advance.

RoundOutTooSoon
  • 9,821
  • 8
  • 35
  • 52

3 Answers3

14

If you set the UIRequiresPersistentWiFi setting in your info.plist file, the iPhone OS will know that your app needs Wifi and pop up the message for you.

As far as I know, no app actually manually displays the wifi selection alert.

Nathaniel Martin
  • 2,082
  • 1
  • 14
  • 11
  • 1
    Was I incorrect? Why was this voted down? From the documentation: "How do I display the WiFi connection dialog? The WiFi connection dialog is displayed if WiFi is available, but not currently in use. If your application requires WiFi, you need to add the UIRequiresPersistentWiFi key to Info.plist and set it True. This key notifies the system that your application uses the WiFi network for communication. See "Using WiFi" in iPhone Application Programming Guide for additional information on this key." – Nathaniel Martin Jul 29 '09 at 23:31
  • Hi Nathaniel, I have no idea who voted you down. But your solutions WORKS for me. Thanks! I'll vote you UP and make this the correct question. However, after turning on and off the wi-fi connection in my iPod for testing, the app stops asking me and doesn't show me the list of networks anymore. What should i do? – RoundOutTooSoon Jul 30 '09 at 00:27
  • Looks like it is `Application uses Wi-Fi" now, but Xcode will update it if you use the above. – anthropomo Aug 11 '13 at 16:50
4

Thats wrong check this app out

http://itunes.apple.com/us/app/ihome-connect-setup-app-for/id450241802?mt=8

It shows available wifi networks

2

The best you can do in iOS, currently, is display the network the user is currently connected to. iOS doesn't allow you to access a wifi scan from within an app. I've been wrestling with this inability for some time now.

If designing an accessory that has WiFi, where you're trying to pass the user's WiFi network SSID and password, it will be up to the accessory to give the app that wifi scan list. The app can then display the list the accessory gave it to the user.

(I bet that's how the app @zaid pointed out in his answer, "iHome Connect", is doing it.)

Another approach is you could have a screen that prompts the user to enter the password to the wifi network they're connected to already, and then once the accessory is connected to the app, pass those details without the need for a wifi network list. I think that approach has a better user experience.

Plenty of stackoverflow questions that answer how to get the current wifi network, here's a couple:

Getting OSX Connected Wi-Fi Network Name

How do I get the current wifi network name after Yosemite in Swift?

Community
  • 1
  • 1
Barbituate
  • 363
  • 2
  • 6