iOS-获取设备wifi 和Mac地址-获取info.plist的数据


import SystemConfiguration.CaptiveNetwork

class BaseDeviceinfoUtil: NSObject {
    /**
     获取wifi名字和mac地址
     */
   class func getWifiInfo()->(ssid:String,mac:String){
        
        if let cfas: NSArray = CNCopySupportedInterfaces() {
            for cfa in cfas {
                if let dict = CFBridgingRetain(CNCopyCurrentNetworkInfo(cfa as! CFString)) {
                    return (T(dict["SSID"]), T(dict["BSSID"]))
                }
            }
        }
        return ("未知", "未知")
    }
    
}

获取info.plist的信息

let deviceInfo = NSBundle.mainBundle().infoDictionary
let appVersion      = T(deviceInfo?["CFBundleShortVersionString"])
let appBuildVersion = T(deviceInfo?["CFBundleVersion"])
let appName         = T(deviceInfo?["CFBundleDisplayName"])
let identifier      = T(deviceInfo?["CFBundleIdentifier"])
通过上面的key,能很好的得出规律这个key都是以CFBundle开头,接上后面的Identifier,
有逗号的写前面,且后面的每个字符都首字母大写

你可能感兴趣的:(iOS-获取设备wifi 和Mac地址-获取info.plist的数据)