Get the security type of the currently connected Wi-Fi 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. It seems that this can be done using the SCDynamicStore API. However, I cannot find a way around this. I also need to submit the application to the Mac App Store and therefore do not want to use any private code. Any pointers or sample code will be very helpful. Thanks in advance.

+4
source share
1 answer
#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 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); 
+1
source

All Articles