1

list all available wireless networks SSID in swift3 i tried but i get only the connected wireless network SSID is that possible

func fetchSSIDInfo() ->  String {
    var currentSSID = ""
    if let interfaces:CFArray = CNCopySupportedInterfaces() {
        print(interfaces)
        for i in 0..<CFArrayGetCount(interfaces){
            let interfaceName: UnsafeRawPointer = CFArrayGetValueAtIndex(interfaces, i)
            let rec = unsafeBitCast(interfaceName, to: AnyObject.self)
            let unsafeInterfaceData = CNCopyCurrentNetworkInfo("\(rec)" as CFString)
            if unsafeInterfaceData != nil {
                let interfaceData = unsafeInterfaceData! as Dictionary!
                for dictData in interfaceData! {
                    if dictData.key as! String == "SSID" {
                        currentSSID = dictData.value as! String
                    }
                }
            }
        }
    }
    return currentSSID
}
  • Possible 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:25

2 Answers2

0

iOS only returns the connected SSIDs. It is not possible to get the other SSIDs in code, neither Swift nor ObjectiveC.

Vincent
  • 4,342
  • 1
  • 38
  • 37
0

AS per Apple philosophy, You cannot access HW, so you cannot query low level details: what You are asking requires Apple will expose lowe level calls they do not consider safe. And Yoy cannot call HW directly, nor write a driver...

ingconti
  • 10,876
  • 3
  • 61
  • 48