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庶骄,能很好的得出規(guī)律這個(gè)key都是以CFBundle開頭裁良,接上后面的Identifier族沃,
有逗號(hào)的寫前面零抬,且后面的每個(gè)字符都首字母大寫