由于客户的某些 SB 要求,偏要监控设备的 WiFi 的开关是否打开,我 Google 了大半圈,硬是没有找到,难道只能监控网络的状态,不能监控 WiFi 开关是否打开吗?求解答……
|  |      1rayps      2015-10-24 16:42:45 +08:00 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 里的代码,忘了是哪个答案里找来的了 | 
|  |      2rayps      2015-10-24 16:44:56 +08:00 现在可能得要换成 Swift 2 的语法 | 
|  |      3sunjourney      2015-10-24 17:21:39 +08:00 via iPhone 这样就骂客户了? | 
|  |      4shierji      2015-10-24 19:46:40 +08:00 这个要求感觉不算过分。。。 | 
|  |      5crayygy      2015-10-24 20:04:28 +08:00 这个要求为啥要骂客户。。。(心疼 lz | 
|  |      6konakona      2015-10-25 11:48:49 +08:00 这个要求合情合理.... | 
|  |      7GhostClock OP @rayps 没看懂呀,哥 Orz | 
|  |      8GhostClock OP |