博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS 获取Wifi的SSID及MAC地址
阅读量:7087 次
发布时间:2019-06-28

本文共 864 字,大约阅读时间需要 2 分钟。

  hot3.png

导入系统头文件 #import 
实现代码NSString *ssid = @"Not Found"; NSString *macIp = @"Not Found"; CFArrayRef myArray = CNCopySupportedInterfaces(); if (myArray != nil) { CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0)); if (myDict != nil) { NSDictionary *dict = (NSDictionary*)CFBridgingRelease(myDict); ssid = [dict valueForKey:@"SSID"]; macIp = [dict valueForKey:@"BSSID"]; } } UIAlertView *av = [[UIAlertView alloc] initWithTitle:ssid message:macIp delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; [av show];

 

转载于:https://my.oschina.net/SoulJa/blog/730010

你可能感兴趣的文章