Get SSID in Swift 2

前端 未结 10 1345
情书的邮戳
情书的邮戳 2020-12-05 05:36

Im trying to use this code to get SSID

import Foundation
import SystemConfiguration.CaptiveNetwork

public class SSID {
    class func getSSID() -> String         


        
10条回答
  •  失恋的感觉
    2020-12-05 06:11

    You can find an another answer with updated Swift standards of @japes answer which supports both Swift 3 and Swift 4. Return empty "" on simulators.

    import SystemConfiguration.CaptiveNetwork
    
    internal class SSID {
    
        class func fetchSSIDInfo() -> String {
            var currentSSID = ""
            if let interfaces = CNCopySupportedInterfaces() {
                for i in 0..

提交回复
热议问题