欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

iOS獲取當(dāng)前連接的wifi信息

 更新時(shí)間:2018年07月24日 11:51:11   作者:大不不  
這篇文章主要為大家詳細(xì)介紹了iOS如何獲取當(dāng)前連接的wifi信息,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了iOS獲取當(dāng)前連接wifi信息的具體代碼,供大家參考,具體內(nèi)容如下

導(dǎo)入框架CaptiveNetwork

#import <SystemConfiguration/CaptiveNetwork.h>

獲取當(dāng)前連接的wifi信息

// 只能獲取當(dāng)前的SSID
- (id)fetchSSIDInfo
{
 NSString *currentSSID = @"";
 CFArrayRef myArray = CNCopySupportedInterfaces();
 if (myArray != nil){
 NSDictionary* myDict = (__bridge NSDictionary *) CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
 if (myDict!=nil){
 currentSSID=[myDict valueForKey:@"SSID"];
 } else {
 currentSSID=@"<<NONE>>";
 }
 } else {
 currentSSID=@"<<NONE>>";
 }
 
 NSArray *ifs = (__bridge id)CNCopySupportedInterfaces();
 NSLog(@"%s: Supported interfaces: %@", __func__, ifs);
 id info = nil;
 for (NSString *ifnam in ifs) {
 info = (__bridge id)CNCopyCurrentNetworkInfo((CFStringRef)CFBridgingRetain(ifnam));
 if (info && [info count]) {
 break;
 }
 }
 
 NSLog(@"wifi info %@",info);
 
 return info;
}
wifi info {
 BSSID = "a4:2b:8c:92:47:3c";
 SSID = "XF-WORLD";
 SSIDDATA = <58462d57 4f524c44>;
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論