我正在尝试确定10.7及更高版本的扫描网络的安全类型和phyMode,但似乎在10.7版本发布后该信息已被删除。到目前为止,我使用的是CWNetwork.securityMode / phyMode的弃用API,但是10.9它已被完全删除,因此我无法确定它。最新的CWNetwork文档没有关于安全模式的任何信息。
任何人都可以帮忙解决这个问题。
编辑:似乎没有人使用它......
谢谢, MP。
答案 0 :(得分:2)
节目有点晚,但您可能想要使用的是:
BOOL isOpenNetwork = [myNetwork supportsSecurity:kCWSecurityNone];
这是检查网络是否安全的简单方法。 您可以在CoreWLANTypes.h(或以下)中查看所有安全类型:
enum {
kCWSecurityNone = 0,
kCWSecurityWEP = 1,
kCWSecurityWPAPersonal = 2,
kCWSecurityWPAPersonalMixed = 3,
kCWSecurityWPA2Personal = 4,
kCWSecurityPersonal = 5,
kCWSecurityDynamicWEP = 6,
kCWSecurityWPAEnterprise = 7,
kCWSecurityWPAEnterpriseMixed = 8,
kCWSecurityWPA2Enterprise = 9,
kCWSecurityEnterprise = 10,
kCWSecurityUnknown = NSIntegerMax,
};
typedef NSInteger CWSecurity;
答案 1 :(得分:0)
使用supportsSecurity方法的解决方案对我来说效果不佳:
main...
{
CWNetwork *network = [self.scanResults objectAtIndex:row];
NSLog(@"%@", network);
NSLog(@"%@", [self securityStringForNetwork:network]);
}
- (NSString*)securityStringForNetwork:(CWNetwork *)network;
{
NSString *securityString = @"Unknown";
if ([network supportsSecurity:kCWSecurityNone])
securityString = @"None";
else if ([network supportsSecurity:kCWSecurityWEP])
securityString = @"WEP";
else if ([network supportsSecurity:kCWSecurityWPAPersonal])
securityString = @"WPA Personal";
else if ([network supportsSecurity:kCWSecurityWPAPersonalMixed])
securityString = @"WPA Personal Mixed";
else if ([network supportsSecurity:kCWSecurityWPA2Personal])
securityString = @"WPA2 Personal";
else if ([network supportsSecurity:kCWSecurityPersonal])
securityString = @"Personal";
else if ([network supportsSecurity:kCWSecurityDynamicWEP])
securityString = @"Dynamic WEP";
else if ([network supportsSecurity:kCWSecurityWPAEnterprise])
securityString = @"WPA Enterprise";
else if ([network supportsSecurity:kCWSecurityWPAEnterpriseMixed])
securityString = @"WPA Enterprise Mixed";
else if ([network supportsSecurity:kCWSecurityWPA2Enterprise])
securityString = @"WPA2 Enterprise";
else if ([network supportsSecurity:kCWSecurityEnterprise])
securityString = @"Enterprise";
return securityString;
}
结果是:
[ssid = RiO-Murmansk,bssid = 54:04:a6:e9:b3:4e, security = WPA2 Personal ,rssi = -48,channel = [channelNumber = 11(2GHz) ,channelWidth = {20MHz}],ibss = 0]
和
WPA个人混合
不匹配。
我想知道确切的安全模式。不是可以支持的安全模式。