3

I am using CNCopySupportedInterfaces() to get bssid and it is not returning any value. Not sure why.

My code looks like this:

    #import <SystemConfiguration/CaptiveNetwork.h>

    CFArrayRef myArray = CNCopySupportedInterfaces();
    CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
    NSLog(@"Connected at:%@",myDict);
    NSDictionary *myDictionary = (__bridge_transfer NSDictionary*)myDict;
    NSString * BSSID = [myDictionary objectForKey:@"BSSID"];
    NSLog(@"bssid is %@",BSSID);

NSLog(@"%@",CNCopySupportedInterfaces());

returns (null)

Not sure what is wrong? Need some guidance

lakshmen
  • 28,346
  • 66
  • 178
  • 276

2 Answers2

5

Just figured out it this code does not work in ios6.. working fine in ios5.. it doesn't work in simulator. Try in the device.

lakshmen
  • 28,346
  • 66
  • 178
  • 276
2

To use CNCopySupportedInterfaces you must enable Access WiFi Information capability in the Capabilities pane of your project settings.

HenryRootTwo
  • 2,572
  • 1
  • 27
  • 27