iphoneiosreachabilitybssid

How to get bssid in iPhone without private library?


I need to get the bssid of the wifi for my iphone application to determine whether it is connected. How do I do it?

Need some guidance on how to do it.


Solution

  • I did it this way:

    NSArray* interfaces = (NSArray*) CNCopySupportedInterfaces();
    
        for (NSString* interface in interfaces)
        {
            CFDictionaryRef networkDetails = CNCopyCurrentNetworkInfo((CFStringRef) interface);
            if (networkDetails)
            {
                NSLog(@"all details: %@", (NSDictionary *)networkDetails);
                NSLog(@"BSSID: %@", (NSString *)CFDictionaryGetValue (networkDetails, kCNNetworkInfoKeyBSSID));
                BSSID1 = (NSString *)CFDictionaryGetValue (networkDetails, kCNNetworkInfoKeyBSSID);
                BSSID = [[BSSID1 stringByReplacingOccurrencesOfString:@":"
                                                           withString:@""] uppercaseString];
                NSLog(@"%@",BSSID);
    
                CFRelease(networkDetails);
            }
        }