我正在尝试使用 NEHotspotConfiguration 以编程方式连接(请参阅下面的代码)。但是,当我尝试连接时,错误显示:“无效的 WPA/WPA2 密码长度”,但我正在连接一个无需密码的开放网络。
我已经看到了一些解决方案,但由于质量原因,我无法使用很多解决方法。
let wifiConfig = NEHotspotConfiguration(ssid: SSID, passphrase: "", isWEP: false)
wifiConfig.joinOnce = false
NEHotspotConfigurationManager.shared.apply(wifiConfig) { error in
if let error = error{
print("Error: " + (error.localizedDescription))
}else {
print("Connected.")
}
}
我能做些什么来解决它?
有一个用于开放网络的特定 API。查看 NEHotspotConfiguration的API 文档,您似乎应该使用init(ssid: String)
而不是init(ssid: String, passphrase: String, isWEP: Bool)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句