尽管连接了wifi,但CNCopySupportedInterfaces()没有返回任何值

lak*_*esh 3 xcode bssid reachability ios captivenetwork

我使用CNCopySupportedInterfaces()来获取bssid并且它没有返回任何值.不知道为什么.

我的代码看起来像这样:

    #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);
Run Code Online (Sandbox Code Playgroud)

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

返回(null)

不确定是什么问题?需要一些指导

lak*_*esh 5

刚想通了这个代码在ios6中不起作用..在ios5中工作正常..它在模拟器中不起作用.尝试使用该设备.