IOS获得wifi的唯一标识

wifi的标识SSID,BSSID

  • SSID wifi名称
  • BSSID wifi的MAC地址
/*获得wifi的唯一标识BSSID
 */
+(NSString *)getBSSIDStr{
    NSArray *names = (__bridge NSArray*)CNCopySupportedInterfaces();
    NSDictionary *info = nil;
    for (NSString *name in names) {
        
        info = (__bridge NSDictionary*)CNCopyCurrentNetworkInfo((__bridge CFStringRef)name);
        
        if (info && [info count]) {
            break;
        }
    }
//NSString *ssidStr = [info objectForKey:(__bridge NSString*)kCNNetworkInfoKeySSID];
    NSString *bssid = [[info objectForKey:(__bridge NSString*)kCNNetworkInfoKeyBSSID] lowercaseString];
    return bssid;
}

你可能感兴趣的:(IOS获得wifi的唯一标识)