SSID全称Service Set IDentifier, 即Wifi网络的公开名称.
#import <SystemConfiguration/CaptiveNetwork.h>
- (NSString *) getSSID
{
NSArray *ifs = (__bridge id)CNCopySupportedInterfaces();
id info = nil;
for (NSString *ifnam in ifs) {
info = (__bridge id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
if (info && [info count]) {
break;
}
}
NSDictionary *dctySSID = (NSDictionary *)info;
NSString *SSID = [dctySSID objectForKey:@"SSID"];
if (SSID && [SSID isKindOfClass:[NSString class]]) {
NSString *ssid = [SSID lowercaseString];
return ssid;
}
else {
return nil;
}
}