如何在ios中获取接入点的mac地址?
问题描述:
我想获得一些关于接入点的独特信息。如MAC地址和强度。我尝试在目标c中使用三个强度最大的无线接入点做三角形。我有xcode 4.3.2和ios 5.1。我怎么能在iOS中做到这一点。如何在ios中获取接入点的mac地址?
答
查找there
尝试这种情况:
CFArrayRef myArray = CNCopySupportedInterfaces();
CFDictionaryRef captiveNetWork = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
NSLog(@"Connected at : %@", captiveNetWork);
NSDictionary *myDictionnary = (__bridge NSDictionary *)captiveNetWork;
NSString *bssid = [myDictionnary objectForKey:@"BSSID"];
NSLog(@"BSSID : %@", bssid);
它崩溃应用程式错误'异常:EXC_BAD_ACCESS(代码= 2,地址=为0x0))' – 2014-01-28 10:43:26
东西为空,哪一行是什么呢? – Larme 2014-01-28 10:53:18
'(__bridge_transfer id)CNCopySupportedInterfaces()'返回nil – 2014-01-28 10:54:53