如何检测所有可用的Wifi网络并在iOS应用程序中连接其中一个 [英] How to detect all available Wifi networks and connect to one of them in an iOS app

查看:119
本文介绍了如何检测所有可用的Wifi网络并在iOS应用程序中连接其中一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iOS应用程序中,我想检测所有可用的wifi网络,然后从列表中选择一个网络并连接到它。目标是不打开内置应用程序设置以连接到wifi,而是在我的应用程序中完成所有操作。

In my iOS app, I want to detect all available wifi networks and then choose one network form the list and connect to it. The goal is to not open the Settings built in app to connect to a wifi, but to do it all in my app.

首先,这可能吗?如果可能的话,请指出我要使用的框架和方法。

First, is this possible? If possible, please point me to what framework(s) and methods to use.

我看过可达性示例,但这对我不起作用,因为,我认为,所有这一切都是监控设备的网络状态。

I have looked at the Reachability example, but that doesn't work for me because, I think, all it does is monitor the network state of the device.

我还查看了强制网络支持框架,并使用了 CNCopySupportedInterfaces function:

I also looked at the Captive Network Support framework, and used the CNCopySupportedInterfaces function:

CFArrayRef allWifiNetworks = CNCopySupportedInterfaces();

NSLog(@"%@", allWifiNetworks);

但我所看到的只是该设备所连接的当前wifi网络。

but all I am seeing is the current wifi network that the device is connected to.

谢谢

推荐答案

我很确定你不能这样做,如果您希望能够在App Store上发布,则至少不会。

I'm pretty sure you can't do this, at least not if you want to be able to publish on the App Store.

这篇关于如何检测所有可用的Wifi网络并在iOS应用程序中连接其中一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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