iOS 获取当前的 wlan 网络名称 [英] iOS get current wlan network name
问题描述
我正在寻找一种方法来获取 iOS5 的 Objective-c 中当前连接的 wlan 网络的信息(至少是名称).
I am looking for a way to obtain information (at least the name) of the current connected wlan network in objective-c for iOS5.
我需要这个,因为我们目前正在开发一个无法在特定网络中运行的应用程序.在这个网络(在我们的大学)中,我们需要连接到服务器的端口是关闭的.但是还有另一个网络可用,我们想告诉用户,如果他连接到上述网络,他必须切换网络.
I need this because we are currently developing an application that do not work in a particular network. In this network (on our university) the port is closed that we need to connect to the server. But there is another network also available and we want to tell the user that he has to switch the network if he is connected to the aforementioned one.
我什至不知道从哪里开始.有没有人有想法或任何提示?
I do not even know where to start. Does anyone have an idea or any hints?
感谢和问候
推荐答案
从 iOS >= 4.1 可以获取设备当前连接的无线网络的 SSID.
From iOS >= 4.1 it's possible to obtain SSID of wireless network that device is currenctly connected to.
为此,您将使用函数 CNCopyCurrentNetworkInfo
有关实施的详细信息可在 SO 上获得:iPhone 在没有私人图书馆的情况下获得 SSID
Details on implemenation are available on SO: iPhone get SSID without private library
这篇关于iOS 获取当前的 wlan 网络名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!