iOS API 检测无线网络

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3977273/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 17:56:57  来源:igfitidea点击:

iOS API detect wireless networks

iphonecocoa-touchioswifi

提问by Andrew J. Brehm

Is there an API in CocoaTouch/iOS for detecting wireless networks? I want to write an app that saves a list of networks the phone can see at a given moment.

CocoaTouch/iOS 中是否有用于检测无线网络的 API?我想编写一个应用程序来保存手机在给定时刻可以看到的网络列表。

回答by Ali

As far as I know you can get the information about the current connected Wi-Fi using CNCopySupportedInterfacesand CNCopyCurrentNetworkInfoof CaptiveNetwork. You can refer to: How do I use CaptiveNetwork to get the current WiFi Hotspot Name for more information.

据我所知,您可以使用CNCopySupportedInterfacesCaptiveNetwork获取有关当前连接的 Wi-FiCNCopyCurrentNetworkInfo信息更多信息可以参考:如何使用 CaptiveNetwork 获取当前 WiFi 热点名称

According to iPhone get a list of all SSIDs without private library:

根据 iPhone 获取没有私人图书馆的所有 SSID 的列表

Without the use of private library (Apple80211) you can only get the SSID of the network your device is currently connected to.

You could have a look at iphone-wirelessproject if you are interested in Apple80211. There exists a sample app "Stumber" which does exactly what you want. But you cannot use this in your app if you want to publish to App Store because as it uses private APIs

如果您对 Apple80211 感兴趣,可以查看iphone-wireless项目。存在一个示例应用程序“ Stumber”,它完全符合您的要求。但是如果你想发布到 App Store,你不能在你的应用程序中使用它,因为它使用私有 API

回答by mustafa96m