We can programmatically connect wifi networks after iOS 11 public API. You can connect wifi using SSID and password like following.
Swift
var configuration = NEHotspotConfiguration.init(ssid: "wifi name", passphrase: "wifi password", isWEP: false)
configuration.joinOnce = true
NEHotspotConfigurationManager.shared.apply(configuration) { (error) in
if error != nil {
//an error occurred
print(error?.localizedDescription)
}
else {
//success
}
}
Don't forget import NetworkExtension
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…