0

我有一个需要连接到设备热点以定期配置其 wifi 的应用程序。似乎每次我想连接到设备热点时,都会提示我一个对话框,要求同意加入 wifi 网络。

谢谢!

在此处输入图像描述

NEHotspotConfigurationManager.shared.apply(hotspotConfig) { error in
    var status: String = ""
    if error == nil {
        status = "connected to SomeNetwork\n"
        print(status)
        completion(status)
        return
    }
    if error?.localizedDescription == "already associated.\n" {
        status = "already connected"
        print(status)
        completion(status)

    } else {
        status = "not connected\n"
        print("not connected")
    }
    completion(status)
}
4

0 回答 0