Scan the nearby Wifi networks and allow to connect to the specific one from that list via App

Hi, I am working on the iOS application that requires to scan and list out all the available wifi networks that are in range(like we can see by turning wifi on from macbook/iOS Device).

Then the app user can select a specific network and connect to that by entering the password. (just like we connect to a wifi from any iOS Device > settings > select a network > enter password > Connected)


My main purpose for this requirement is that my app wants to disable/enable some app specific functionality when user is connected to the specific wifi network. for ex: I want to set/unset an internal wifi zone specific functionality when user is connected/disconnected.

I have read many documents and answers but most of them says "I need to apply for the special permission to access this functionality - that is Hotspot Helper Request".

But I do not want to use Hotspot specific functionality. My requirement is very clear. Just need to fetch the nearby wifi and connect to one from the app.
Please guide me for this. Thanks in anticipation.

I’m confused by your requirements here. First you wrote:

I am working on the iOS application that requires to scan and list out all the available wifi networks that are in range

And then you wrote:

My main purpose for this requirement is that my app wants to disable/enable some app specific functionality when user is connected to the specific wifi network.

I’m not sure how these two statements connect. If you want to disable specific functionality within your app when the device is connected to a specific network, you don’t to get involved in scanning for Wi-Fi networks, you just need to know what Wi-Fi network the device is currently associated with. And you can do that using

CNCopyCurrentNetworkInfo
.

Share and Enjoy

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

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

Hello Eskimo!


Thanks for your response. I am very sorry for the confusion here.


Let me be more specific to you.


"I want my app to scan the available wifi networks and then let the user select a network to connect from within the app itself."


The purpose behind this specific functionality is that,


I am developing an IOT based app in which,


1. A user can Scan for the nearby Wifi Networks

2. Once Scanned, a user can select a specific Wifi and connect to it

3. Once connected, my app will enable/disable some app functionalities to interact with BLE Device for that specific Wifi Zone/Area/Range

4. Also, when roaming around, a user can change his Wifi Zone/Area/Range (by following above 1,2,3 Steps again) within app to again enable/disable BLE interaction.


Hope that makes sense now.

Thanks.

iOS does not have a general-purpose Wi-Fi scanning API. We do have a number of special Wi-Fi APIs. You can find a list of these, and pointers to further information, in QA1942 iOS Wi-Fi Management APIs.

Looking through your list of steps:

1. A user can Scan for the nearby Wifi Networks

There’s no way to do this. The standard list of alternatives is:

  • Support WAC in your accessory — I don’t think this is a good match for your sitation.

  • Bluetooth LE — If your Wi-Fi network advertises its details via Bluetooth LE, you can use Core Bluetooth to discover those details.

  • Barcode — For some accessory vendors this is a great solution: Their accessory already has a label with the Wi-Fi details available via a barcode, and so they can just implement a barcode scanner to get those details.

    Honestly, I’m not sure how well this would fit into your intended use case.

  • Ask the user )-:

2. Once Scanned, a user can select a specific Wifi and connect to it

You should be able to do this with

NEHotspotConfigurationManager
.

3. Once connected, my app will enable/disable some app functionalities to interact with BLE Device for that specific Wifi Zone/Area/Range

Once you’ve moved the iOS device to the relevant network, talking to your accessory on that network is your concern.

4. Also, when roaming around, a user can change his Wifi Zone/Area/Range (by following above 1,2,3 Steps again) within app to again enable/disable BLE interaction.

I don’t think this presents any challenges beyond those in steps 1, 2 and 3.

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"
Scan the nearby Wifi networks and allow to connect to the specific one from that list via App
 
 
Q