IOS&Swift

获取wifi名称

2018-12-10  本文已影响14人  iOS祎
image.png
+ (NSString *)ssid {
    NSString *ssid = nil;
    NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
    for (NSString *ifnam in ifs) {
        NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
        NSLog(@"dic===%@",info);
        if (info[@"SSID"]) {
            ssid = info[@"SSID"];
        }
    }
    return ssid;
}
上一篇下一篇

猜你喜欢

热点阅读