开发者

Get security type of currently connected wifi network for Mac OS X using cocoa

I need to find the security type (ex- WPA2, WEP) of the currently connected network on a Mac. I am targeting Mac OS 10.3. Seems that this can be done using the SCDynamicStore API开发者_Go百科. However, I am unable to find my way around this. Also I need to submit the app to the Mac App Store and hence do not want to go for any private code. Any pointers or a sample code would be very helpful. Thanks in advance.


#import <CoreWLAN/CoreWLAN.h>

CWInterface* wifi = [[CWWiFiClient sharedWiFiClient] interface];
NSString *securityType = [wifi security];// this is given you  enum(some number) and u can do function that return the correct string with the name according this enum

this is the ENUM:

typedef NS_ENUM(NSInteger, CWSecurity)
{
    kCWSecurityNone                 = 0,
    kCWSecurityWEP                  = 1,
    kCWSecurityWPAPersonal          = 2,
    kCWSecurityWPAPersonalMixed     = 3,
    kCWSecurityWPA2Personal         = 4,
    kCWSecurityPersonal             = 5,
    kCWSecurityDynamicWEP           = 6,
    kCWSecurityWPAEnterprise        = 7,
    kCWSecurityWPAEnterpriseMixed   = 8,
    kCWSecurityWPA2Enterprise       = 9,
    kCWSecurityEnterprise           = 10,
    kCWSecurityUnknown              = NSIntegerMax,
} NS_ENUM_AVAILABLE_MAC(10_7);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜