我们可以在ios模拟器中获取wifi名称吗?

时间:2016-01-08 10:48:41

标签: ios wifi

我可以从真实设备获取wifi名称,但在模拟器中它没有给出任何价值。是否可以在模拟器中获取wifi名称?是否有任何选项可以获得像位置服务这样的默认wifi名称?

以下是我在真实设备上获取wifi名称的代码

- (NSDictionary *)fetchSSIDInfo
{
    NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces());
    NSLog(@"%s: Supported interfaces: %@", __func__, interfaceNames);

    NSDictionary *SSIDInfo;
    for (NSString *interfaceName in interfaceNames) {
        SSIDInfo = CFBridgingRelease(
                                     CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName));
        NSLog(@"%s: %@ => %@", __func__, interfaceName, SSIDInfo);

        BOOL isNotEmpty = (SSIDInfo.count > 0);
        if (isNotEmpty) {
            break;
        }
    }
    return SSIDInfo;
}

0 个答案:

没有答案