有没有办法使用iPhone SDK获取WiFi信息?像信号强度,WiFi频道和SSID这样的东西是我正在寻找的主要内容.
只对Wifi信息感兴趣,而不是蜂窝信息.
我需要获取当前连接的Wi-Fi热点的名称,例如"BT OpenZone"
我被告知可以使用CaptiveNetwork特别是CNCopyCurrentNetworkInfo 来完成
我的代码到目前为止:
#import <SystemConfiguration/CaptiveNetwork.h>
...
// Get the dictionary containing the captive network infomation
CFDictionaryRef captiveNtwrkDict = CNCopyCurrentNetworkInfo(kCNNetworkInfoKeySSID);
// Get the count of the key value pairs to test if it has worked
int count = CFDictionaryGetCount(captiveNtwrkDict);
NSLog(@"Count of dict:%d",count);
Run Code Online (Sandbox Code Playgroud)
当代码在WiFi热点的设备上运行时,captiveNtwrkDict为零.
有没有人设法让它工作?我无法在CaptiveNetworks上找到很多文档或任何示例代码示例...任何帮助将不胜感激.