How can I get a list of available WiFi networks from IOS app?

I want to get a list of available Wi-Fi networks in my IOS app and establish a connection with the user selected network without having to leave the app. How can i do this?

Replies

There’s no supported way to do this on iOS. Why do you need this? iOS has infrastructure that can help in some circumstances, so if you explain your high-level goal I may be able to point you in the right direction.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

We are also running into similar kind of situation where we need to access list of available WIFI networks. In our app we need to configure a device to connect to the WIFI network selected by user. Initially the device itself acts a Access point so we need to scan for the device(AP) , temporary connect to it and then send WIFI network settings picked up by the user to the device. Once the device connects to the WIFI network it no longer acts as a Access Point. Is it possible to achieve this functionality on iOS?

I had the same problem, recently

I had the same problem, recently

OK then. I’ll respond to ATUL CHOUHAN’s specific issue, namely:

In our app we need to configure a device to connect to the WIFI network selected by user.

The best way to do this is via Wireless Accessory Configuration (WAC). This makes the whole process completely seamless. In fact, a user doesn’t even have to run your app to get your accessory on their Wi-Fi; they can do it all from Settings.

QA1942 iOS Wi-Fi Management APIs has references to information about WAC.

If WAC isn’t an option for you then the next best approach is have your app temporarily switch iOS to the accessory’s Wi-Fi network using NEHotspotConfigurationManager. There’s a few drawbacks here:

  • NEHotspotConfigurationManager requires iOS 11 (which, btw, is why it’s not yet covered in QA1942).

  • You need to know the accessory’s SSID. If each instance of your accessory uses a different SSID, you’ll have to discover the SSID via other means (a common approach is to have the accessory publish that information via Bluetooth LE).

If this doesn’t cover your specific case, please post more details about what you’re really trying to do.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I'm in the same situation as ATUL CHOUHAN above and I have a follow up question from your answer:

"The best way to do this is via Wireless Accessory Configuration (WAC). This makes the whole process completely seamless. In fact, a user doesn’t even have to run your app to get your accessory on their Wi-Fi; they can do it all from Settings."


Would that mean that you would have to:

  1. join the MFi Program?
  2. apply and get some kind of approval from Apple?
  3. manufacture the device to also contain an MFi component of some sort?
  4. develop the app to communicate using WAC somehow (we need to configure other settings in the device as well, so it's not enough for us to just let the user set things up through Settings, but that part sounds nice for simpler setups)?


Thing is, we already have a WiFi component in the device and the question is how we can avoid adding a Bluetooth LE (BLE) component on the chip, but still get the configuration settings transferred to the device. BLE would have been a straightforward and "easy" way, bu we need to save that space for other components as it looks now.

Would that mean that you would have to:

1. join the MFi Program?

Yes.

2. apply and get some kind of approval from Apple?

Yes.

3. manufacture the device to also contain an MFi component of some sort?

I think so, but I’m not disclosed on MFi so I can’t give you definitive answers to technical questions about that.

4. develop the app to communicate using WAC somehow (…)?

Yes. The nice thing here is that you can use EAWiFiUnconfiguredAccessory to set up the Wi-Fi side of your accessory from within your app and then lead the user into the next stage of the setup process where you talk to the accessory via standard networking.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

"...the next stage of the setup process where you talk to the accessory via standard networking."

You mean to use standard HTTP requests or communicating on an even lower socket level etc.?

You mean to use standard HTTP requests or communicating on an even lower socket level etc.?

Either work would. Once your device and accessory are on the same network, you can use any TCP/IP networking protocol you like to communicate. Of specific interest is Bonjour (specifically DNS-SD and mDNS), which will let you discover your accessory.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Eskimo, I have a similar (might be the same) isssue as pt_test. To answer your folllow up question "Why do you need this?" my answer is the following: I have a external device that omits its own Wifi signal. With out leaving our application, we need to be able to open a Wireless Network window that gives a user the option to choose a Wireless Network from a dropdown list. We are trying to give the user the ability to select a Wifi network (to connect to our device), then transfer information from the device into our app. Next, still without leaving our application, the user should again be able to open a Wireless Network window to connect to the local Wifi to access the internet (a differnt Wifi connection). We are finding it very cumbersome to ask the user to open up a settings application (a separate application) just to change between different WiFi networks - it would be much easier if we could give the user a Wifi button/icon that would generate a pop up window listing all available Wifi networks. Then the user can choose which one they want to connect/dis-connect to. Note: we do not have the ability to pair our wifi device. What can you best suggest for this specific need? Thank you.

First up, feel free to file a enhancement request for the features you’d like to see added to the OS, although please be realistic about the big picture here. Developers have been asking Apple for a general-purpose Wi-Fi scanning API since the first iPhone SDK, and thus I think it’s safe to assume that its absence in not accidental.

While Apple has not made any official statements about this, one obvious sticking point is privacy. If you’re going to file an ER you should be mindful of the platform’s overall privacy goals. For example, a general-purpose Wi-Fi scanning API would represent a serious privacy concern, whereas an API that pops up the Wi-Fi choice dialog would not.

If you do file an ER, post your bug number, just for the record.

Second, what can you do about this today? The best match for your requirements is

NEHotspotConfigurationManager
. The main gotcha here is that you need to know the SSID and credentials for the network you want to join. You can get this info in a variety of ways:
  • Ask the user to manually enter it.

  • Ask the user to manually join the network once and then get this info from your accessory.

  • Use some side channel to get this info (like Bluetooth LE) directly from the accessory.

Note that if you set

joinOnce
when you join the network, iOS will automatically leave the network (and typically rejoin the standard infrastructure Wi-Fi) when the user leaves your app.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi Eskimo, we are in a similar situation


We have a requirement for our client. We have developed a hardware that records movements and tilt using an Accelerometer .


The hardware device is capable of transferring data over WIFI. Once the WiFi is configured the device is able to send its data to the cloud. We need to configure it the Wifi ssid and its password and we need to send this information over BTLe channel using an iOS device.


could it be possible for our app (Pikolin's app) scan for nearby SSIDs?. Is it possible?


the app will scan for nearby SSIDs , the user then can select one of them and then, the user can insert the password. The App will send that information via Bluetooth to the device and it will be configured.


We don't need the pass, only the SSID name.


Could it be possible ?
Thanks !

could it be possible for our app (Pikolin's app) scan for nearby SSIDs?

No. Things has not changed substantially since my 1 Dec 2017 post.

ps That post assumes you only have control over the iOS side of this equation. If you have the ability to change the accessory’s firmware or hardware, there are other options available to you. Let me know if that’s the case.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

thanks Eskimo !

Yes, we have the ability to change the accessory's firmware , what options do you have in mind to offer us?


All the best !

If you have control over the accessory, you have more options:

  • The best option is WAC (see QA1942 for links). WAC makes it super easy for an accessory to get on to the user’s Wi-Fi, and is by far the best solution to this problem.

    WAC accessories must be built under the aegis of the MFi programme. I’m not disclosed on MFi, so I can’t speak definitively on that topic, but my understanding is that WAC requires custom hardware. Presumably that hardware is not present on your current generation of devices, but you should talk to the MFi folks about implementing that in your next generation.

  • In the absence of WAC, the final user experience is going to be less than ideal. If your main goal is to get the accessory on to the same network as iOS, you can use use

    CNCopyCurrentNetworkInfo
    to get that network’s SSID.
  • If, however, you want to offer the user a choice of networks, you won’t be able to do that on iOS. However, you can take advantage of your control over the accessory’s firmware to help things along. Use Bluetooth LE to talk to the accessory and ask it to scan for Wi-Fi networks on your behalf and pass you back the results.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi eskimo,

I am using NEHotSpotConfiguration and NEHotSpotConfigurationManager class from NetworkExtension framework to programatically connect to the WiFi network.

Please find below the code:


let config = NEHotspotConfiguration(ssid: "strSSID", passphrase: "strPassword", isWEP: false)

config.joinOnce = true

NEHotspotConfigurationManager.shared.apply(config) { (error) in

if error != nil {

print(error!.localizedDescription)

callBack(false)

}

else {

print(String(format:"Successfully connected to the Wi-Fi %@",strSSID))

callBack(true)

}

}


Do I need to get the special entitlement permission from Apple to publish my application to the AppStore?

Please respond.