首页 > 解决方案 > 如何区分不同配置的网络?

问题描述

我有一个配置 Passpoint 和 WPA Enterprise 网络的应用程序。

我正在使用NEHotspotConfigurationManager.getConfiguredSSIDs()查看我的应用配置了哪些网络。它确实返回正确的数据,即域或 SSID;我两个都懂。

但我的问题是我的 passpoint 域和 WPA Enterprise SSID 是相同的值,例如example.com

有没有办法可以区分检查这example.com是 passpoint 还是 WPA Enterprise?

甚至获取实际的配置数据,例如域、EAP 类型、用户名等?我可以使用那里的一些数据来区分两者。

为什么?我需要能够检查是否安装了任一配置,但因为它们都是同名的;使用下面的函数证明它很麻烦。

我可以有不同的名字吗?不幸的是,没有。

func configCheck(searchString: String, completionHandler: @escaping CompletionHandler) {
var flag = false;
let manager = NEHotspotConfigurationManager.shared;
manager.getConfiguredSSIDs {
  (ssidsArray) in
    print("COUNT: ", ssidsArray.count)
  for ssid in ssidsArray {
     print("SSID: ", ssid)
  }
  if ssidsArray.contains(searchString) {
 flag = true
print("true")
 }
 else {
   flag = false
print("false")
 }
 completionHandler(flag)
 }
 }

以上将打印;

计数:2

SSID: example.com (Is this passpoint or enterprise?)
SSID: example.com (Is this passpoint or enterprise?)

标签: iosswiftnetworkingmobile

解决方案


推荐阅读