我想从诸如mac地址(bssid)之类的接入点获取一些独特的信息。我尝试了这段代码,但它只在我连接网络时才有效..
- (id)fetchSSIDInfo
{
NSArray *ifs = (id)CNCopySupportedInterfaces();
NSLog(@"%s: Supported interfaces: %@", __func__, ifs);
id info = nil;
for (NSString *ifnam in ifs) {
info = (id)CNCopyCurrentNetworkInfo((CFStringRef)ifnam);
NSLog(@"%s: %@ => %@", __func__, ifnam, info);
if (info && [info count]) {
break;
}
[info release];
}
[ifs release];
return [info autorelease];
}
即使我没有连接,我如何从我周围的接入点获取 bssid,这可能吗?