My users get a prompt that disrupts the use of my app.
The prompt comes more than 10 seconds into using a remote controlled IoT device via WiFi. The device is a drone, so it's not plausible to pause and it's absurd to have them wait so long for this prompt to appear to begin flight safely.
The Wi-Fi network "MySSID" does not appear to be connected to the Internet
Do you want to temporarily use cellular data?
Use Cellular Data
Keep Trying Wi-Fi
I connect with NEHotspotConfigurationManager https://developer.apple.com/documentation/networkextension/nehotspotconfigurationmanager
hotspotConfig = NEHotspotConfiguration(ssid: mySSID)
guard let hotspotConfig = hotspotConfig else {
print("Error while connecting to WiFi")
return
}
hotspotConfig.joinOnce = true
NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: ssid)
NEHotspotConfigurationManager.shared.apply(hotspotConfig) { [self] (error) in
if let error = error {
print(self.handleConnectionError(error))
completion(false)
} else if self.wifiConnectionInfo() != nil {
completion(true)
} else {
completion(false)
}
}
How do I prevent this? Or is there any workaround?