seniorbenelli
seniorbenelli

Reputation: 838

Mac OS X: How can I get the MAC addresses of all available WiFi networks?

I need to get the MAC addresses of all WIFI networks which are founded by the WIFI module. After collecting them, I need to compare them with another MAC address, which is static and saved in the app. My goal is it, to only allow to use the app, if you are close enough at the router.

Is there any chance to do this? And it is very important, to follow Apple's rules, because I want to release the app in the Appstore. Please help me! Thanks in advance!

Upvotes: 3

Views: 1292

Answers (1)

Almog_0
Almog_0

Reputation: 422

#import <CoreWLAN/CoreWLAN.h>

 CWInterface *currentInterface = [CWInterface interface];
 NSArray *networks = [[currentInterface scanForNetworksWithName:nil error:nil] allObjects];
for (CWNetwork *network in networks) {
      NSLog ( @"SSID: %@, BSSID: %@.\n", [network ssid],[network bssid] ,[network rssiValue]);
}

As u can see here: http://www.smipple.net/snippet/morph/List%20all%20available%20WiFi-Acess%20points%20with%20SSID%20and%20BSSID%20under%20OS%20X

With the RSSI value u can check if you are close enough to the router.

AP MAC address = BSSID U can read about that at the link below: http://www.juniper.net/documentation/en_US/network-director1.5/topics/concept/wireless-ssid-bssid-essid.html

Upvotes: 1

Related Questions