在iPhone中以编程方式列出所有Wi-Fi SSID [英] listout all wi-fi SSID programmatically in iphone

查看:35
本文介绍了在iPhone中以编程方式列出所有Wi-Fi SSID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1).我想以编程方式在iPhone中获取所有wi-fi SSID列表.

1). I want to get all list of wi-fi SSID programmatically in iphone.

我尝试下面的代码,但是它只提供连接的SSID详细信息.

I try following code but it give only connected SSID detail.

NSArray *ifs = (id)CNCopySupportedInterfaces();
NSLog(@"%s: Supported interfaces: %@", __func__, ifs);
id info = nil;
for (NSString *ifnam in ifs) {
    info = (id)CNCopyCurrentNetworkInfo((CFStringRef)ifnam);
    NSLog(@"%s: %@ => %@", __func__, ifnam, info);
    if (info && [info count]) {
        break;
    }
    [info release];
}

2).另一个问题是,当我的Wi-Fi处于关闭状态时,如何确定自己是否属于Wi-Fi范围.Wi-Fi处于关闭状态时,是否可以识别出我在Wi-Fi范围内?

2). Another question is that how can I identify that if I am come range in wi-fi when my wi-fi is OFF. Is it possible to identify that I am in range of wi-fi when wi-fi is OFF ?

推荐答案

1)您只能使用

1) You can only get details about your current network, such as SSID or BSSID, using the CaptiveNetwork Framework that you're already using in your example. Apple doesn't allow developers to seek other networks in addition to the one the user is currently connected.

2)根据 Reachability 页,您可以使用该库检查用户当前是否通过3G或WiFi连接.Wi-Fi设置为关"时,您不知道自己是否在范围内.

2) According to the Reachability page, you can use that library to check if the user is currently connected via 3G or WiFi. You can't know if you are in range when Wi-Fi is set to Off.

这篇关于在iPhone中以编程方式列出所有Wi-Fi SSID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆