bssid可以用来判断设备是否是在同一WiFi,ssid用来展示WiFi名称。
获取wifi信息比较简单,直接贴代码。
首先引入
#import <SystemConfiguration/CaptiveNetwork.h>
获取代码
+ (NSDictionary *)wifiInfo {
NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
NSLog(@"interfaces:%@",ifs);
NSDictionary *info = nil;
for (NSString *ifname in ifs) {
info = (__bridge_transfer NSDictionary *)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifname);
NSLog(@"%@ => %@",ifname,info);
}
return info;
}
日志打印
2016-11-10 16:15:06.752 GTRRemoteSTB[6051:3034112] interfaces:(
en0
)
2016-11-10 16:15:14.689 GTRRemoteSTB[6051:3034112] en0 => {
BSSID = "b0:34:95:f1:59:da";
SSID = GTR;
SSIDDATA = <475452>;
}