由于客户的某些 SB 要求,偏要监控设备的 WiFi 的开关是否打开,我 Google 了大半圈,硬是没有找到,难道只能监控网络的状态,不能监控 WiFi 开关是否打开吗?求解答……
由于客户的某些 SB 要求,偏要监控设备的 WiFi 的开关是否打开,我 Google 了大半圈,硬是没有找到,难道只能监控网络的状态,不能监控 WiFi 开关是否打开吗?求解答……
|
raypsOct 24, 2015
1
func getSSID() -> String {
let interfaces = CNCopySupportedInterfaces() if interfaces == nil { return "WiFi Not Found" // Simulator } let interfacesArray = interfaces.takeRetainedValue() as! [String] if interfacesArray.count <= 0 { return "Error" } let interfaceName = interfacesArray[0] as String let unsafeInterfaceData = CNCopyCurrentNetworkInfo(interfaceName) if unsafeInterfaceData == nil { return "No WiFi Connected" // 4G } let interfaceData = unsafeInterfaceData.takeRetainedValue() as Dictionary! return interfaceData["SSID"] as! String } 这是我在 TodayWiFi 里的代码,忘了是哪个答案里找来的了 |
|
raypsOct 24, 2015
2
现在可能得要换成 Swift 2 的语法
|
|
sunjourneyOct 24, 2015 via iPhone
3
这样就骂客户了?
|
|
shierjiOct 24, 2015
4
这个要求感觉不算过分。。。
|
|
crayygyOct 24, 2015
5
这个要求为啥要骂客户。。。(心疼 lz
|
|
konakonaOct 25, 2015
6
这个要求合情合理....
|
|
7
@rayps 没看懂呀,哥 Orz
|
|
8
|