Can I use NEHotspotConfigurationManager to prevent "The Wi-Fi network does not appear to be connected to the internet" prompt using Wi-Fi IoT Device

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?

Replies

How do I prevent this? Or is there any workaround?

I am not aware of a way to workaround this. Generally this will happen when there is other network traffic trying to access the wider internet and it cannot reach the internet. This prompt is a system prompt. If your app controls other internet traffic trying to access the internet, and it is using an API like NWConnection, then you can try binding to the connection to the cellular interface for this traffic during this time to see if it has an impact. Take a look at requiredInterface.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
  • I submitted a feature request to specify that a Hotspot connection will not be for Internet/Data. This negatively impacts the UX of an IoT device that uses WiFi to remotely control a device. Thanks for your response and confirmation that I can't do anything about it

Add a Comment

I submitted a feature request to specify that a Hotspot connection will not be for Internet/Data.

What was the bug number?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Add a Comment

I submitted it on the Apple.com feedback page

If you log in you should be able to see a list of bugs that you’ve filed. Each entry has a subtitle that includes a bug number of the form FBnnnnnnn, where each n is a decimal digit.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Add a Comment