I need to create an app that can get a list of all available wifi networks' names and information on their iPhone, and when the user clicks on some network they should connect to it. Can I do this, and how?
-
1This will be the possible answer: https://stackoverflow.com/a/40683210/5167909 – Faysal Ahmed Mar 28 '18 at 04:32
-
Can you give any example of NetworkExtension how to implementation ? – Akash Mar 28 '18 at 04:42
-
https://stackoverflow.com/questions/5198716/iphone-get-ssid-without-private-library – Rashed Mar 28 '18 at 04:55
-
@ Md Rashed Pervez it is displaying only current connected network but i need all network name those are availabel – Akash Mar 28 '18 at 05:03
-
1Possible duplicate of [iPhone get a list of all SSIDs without private library](https://stackoverflow.com/questions/9684341/iphone-get-a-list-of-all-ssids-without-private-library) – Senseful Sep 24 '18 at 05:22
-
Did you get any perfect answer? I am looking for same functionality. Please help. – Vikas Dec 22 '20 at 07:02
3 Answers
It is not possible to get all the available wifi networks names and information. BUT it is only possible to get the SSID
(SSID
is simply the technical term for a network name) of the network that you are currently connected to.
This class will show only the wifi network name you are connected to -
import UIKit
import SystemConfiguration.CaptiveNetwork
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel!
override func viewDidLoad(){
super.viewDidLoad()
let ssid = self.getAllWiFiNameList()
print("SSID: \(ssid)")
}
func getAllWiFiNameList() -> String? {
var ssid: String?
if let interfaces = CNCopySupportedInterfaces() as NSArray? {
for interface in interfaces {
if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? {
ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String
break
}
}
}
return ssid
}
}
OUTPUT- (Network name where i am connected to )
To test this you need a physical device (iPhone) connected to your pc.

- 2,349
- 11
- 26
-
4Yes That i am getting current connected but i want to all list of available network – Akash Mar 28 '18 at 05:34
-
-
1What i have done so far..i shared with you. All example will show the name you connected to.Not the list of wifi. you can use Network reachability to show the settings page of you iPhone- then the user will decide where to connect(user will see all the available wifi list there). If you find my answer helpful you can accept my answer :). Thanks – Rashed Mar 28 '18 at 05:53
By doing some research I found that:
It is NOT possible in iOS to scan all nearby SSID. We can only get currently connected wifi SSID.
If we somehow do this with any private library, App will be rejected by Apple.
Some helpful Links I want to share -
- https://forums.developer.apple.com/thread/39204
- iOS 11.0 - Periodically scan for SSIDs (WiFi) nearby
You can get connected wifi SSID by these methods:
Swift (3 and 4) -
import SystemConfiguration.CaptiveNetwork
func fetchSSIDInfo() -> String? {
var ssid: String?
if let interfaces = CNCopySupportedInterfaces() as NSArray? {
for interface in interfaces {
if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? {
ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String
break
}
}
}
return ssid
}
Objective-C -
#import <SystemConfiguration/CaptiveNetwork.h>
+(NSString*)fetchSSIDInfo {
NSArray *ifs = (__bridge_transfer NSArray *)CNCopySupportedInterfaces();
NSDictionary *info;
for (NSString *ifnam in ifs) {
info = (__bridge_transfer NSDictionary *)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
if (info && [info count]) {
return [info objectForKey:@"SSID"];
break;
}
}
return @"No WiFi Available";
}
-
so is there really no way to this ? to scan all nearby SSIDs ??. We can only get currently connected wifi SSID ?? in iOS? – shaqir saiyed Aug 08 '19 at 11:21
-
-
Alexander Volkov, please reference some documentation or write an answer, not a comment, on how to do this. It's not helpful to simply contradict someone without supporting your claim. – David Rector Jan 25 '23 at 06:41
Yes it is possible.You need to complete a questionnaire at https://developer.apple.com/contact/network-extension, and then you can use NEHotspotHelper to return a list of hotspots.

- 310
- 2
- 4
-
NEHotspotNetwork will only return a list of networks when the user navigates to the Wi-Fi page in Settings. See https://stackoverflow.com/a/52473480/35690 for more details. – Samball Dec 30 '19 at 08:53