1.在做BLE的时候,需要告诉周边设备连接中央设备所连接的WIFI,获取中央设备所连接WIFI的名字如下:
_wifiNameLabel.text=[[self currentNetworkInfo] objectForKey:@"SSID"];
(PS:[self currentNetworkInfo]该方法返回字典,要取SSID对应的Value。
{
BSSID = "a8:86:dd:a9:73:8b";
SSID = App;
SSIDDATA = <417070>;
}
)
#pragma mark- 获取该设备连接的wifi
-(id)currentNetworkInfo
{
NSArray * ifs = (__bridge id)CNCopySupportedInterfaces();
id info = nil;
for (NSString * ifname in ifs)
{
info = (id)CFBridgingRelease(CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifname));
if(info && [(NSDictionary *)info count])
{
break;
}
}
return info;
}