I want to get all the WiFi networks available in a region and their SSID and SSIDDATA value. Using this I am able to get the SSID and SSIDDATA value for the WiFi network that I am using. But the problem is how to get the SSID and SSIDDATA of all the WiFi network available even if I am not connected to one. I do not want to do it using the private API like in case of stumbler as it will be rejected by AppStore. Please advice.
Asked
Active
Viewed 1,330 times
2 Answers
1
The simple answer is that you can't get them without using private APIs.

Christoph Wimberger
- 136
- 1
- 5
0
I believe you might be able to through Apple's SystemConfiguration API.
This code segment from another post might be useful:
import UIKit
import Foundation
import SystemConfiguration.CaptiveNetwork
class FirstView: UIViewController
{
@IBOutlet weak var label: UILabel!
override func viewDidLoad()
{
super.viewDidLoad()
let ssid = self.getWiFiName()
print("SSID: \(ssid)")
}
func getWiFiName() -> 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
}
}

Community
- 1
- 1

Brandon Lee
- 194
- 2
- 12
-
This will return only current connected wifi information. The question is all available wifi networks and not connected. First of all, Try to understand the question before writing any answer. – Mar 05 '18 at 11:14