We're building an iOS and Android app that transfers files to and from a device over a Wi-Fi network the device creates. That network has no internet access. The app gets the Wi-Fi credentials from the device (over Bluetooth, or from a QR code on its screen) and joins with NEHotspotConfiguration. Android works reliably. On iOS, partway through a session the phone leaves the device's network and joins a saved network that has internet, which breaks our connection to the device.
Setup:
- iPhone 13 Pro, iOS 26.x
- NEHotspotConfiguration(ssid:passphrase:isWEP: false) with joinOnce = false. With joinOnce = true, iOS usually stays on the current internet Wi-Fi and never joins the device's network.
- WPA2. The device is at 192.168.4.1, and its DHCP server hands out the device as router and DNS.
- Device traffic: NWConnection (TCP) with prohibitedInterfaceTypes = [.cellular]. Server traffic: a separate NWConnection with requiredInterfaceType = .cellular.
- Wi-Fi Assist is off.
Example: we read an 8 MB file from the device (30 s, no problem), then post it to our server over cellular (93 s). During the post, the device connection carries only a small message every ~15 s. 28 s into the post, NWPathMonitor shows Wi-Fi drop out for 3 s, and when it returns the phone is on the our primary network. Occasionally iOS shows a prompt asking whether to stay connected without internet, but usually it switches without asking. We haven't seen it switch during the file read, while the device connection is busy.
Questions:
- Is there a supported way to keep iOS on a device's no-internet network for a whole session?
- Does traffic on the Wi-Fi interface (such as an active NWConnection) affect whether iOS switches away?
- Would a DHCP configuration without a router or DNS server change how iOS treats the network?
- Is joinOnce = false right for this, or can joinOnce = true join when the phone is already on an internet-capable Wi-Fi?