Get SSID in Swift 2

前端 未结 10 1364
情书的邮戳
情书的邮戳 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:25

    In Swift 3 (works in real device and simulator):

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

    Usage:

    SSID.fetchSSIDInfo()
    
    //will return "" if no connected wifi or running in simulator 
    

提交回复
热议问题