how to force WKWEBView or app to use WIFI over cellular

My app connects to an accessory via the hotspot provided by the accessory. This Wifi has no internet connection. Also app uses web WKWEBView to load UI So when the mobile data is on, even though the wifi is connected priority is for mobile Data. All the local request that is sent to the accessory is failing.

Is there a way to force the WKWebView or app to use WIFI over cellular?

Answered by DTS Engineer in 725448022

Is "r. 20545691" the radar id requesting for that feature in WKWebView.

Yes.

If yes how can I track the status ?.

You can’t directly. Your best option is to file a bug describing your requirements and noting that it should probably be dup’d to that bug. The standard bug system will then notify you when (well, I should say “if and when”) that bug gets resolved.

For this and other tips, see my Bug Reporting: How and Why? post.

Share and Enjoy

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

WKWebView has no way to force it to run over a specific interface.

My app connects to an accessory via the hotspot provided by the accessory.

Is this an accessory that you control? Or are you trying to work with an accessory created by another third party?

Share and Enjoy

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

@eskimo Is this an accessory that you control? Or are you trying to work with an accessory created by another third party?

  • This is an accessory that my client develop. So I can give suggestions.

OK, cool.

Problems like this crop up when the accessory ‘lies’ to iOS, telling iOS that it provides connectivity to the wider Internet. At that point iOS switches the default route to the accessory’s network and APIs that rely on the default route, like WKWebView, start failing.

My general advice here is that your accessory not advertise Internet connectivity. The user can join the accessory’s network but iOS will not switch the default route, meaning WKWebView will continue to work. Meanwhile, you can continue to talk to the accessory by scoping your network connections to the Wi-Fi interface.

Share and Enjoy

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

@eskimo

I forgot to mention that the web view is loading the UI from the accessory. That is web view is communicating with the accessory.

Since there is no internet connection the iOS switches to the default route and hence the web view start failing.

I forgot to mention that the web view is loading the UI from the accessory.

Oh, I misread your initial post and got everything backwards. Sorry.

So, yeah, to get the default route on to Wi-Fi your accessory must ‘lie’ really well, and that’s not something I recommend [1]. Unfortunately that leaves you with very few options. With UIWebView you could intercept all the network connections coming out of the web view and run them yourself — so, in this case, you’d force them to run over Wi-Fi rather than WWAN — but these days to have to use WKWebView and it doesn’t support such shenanigans (r. 20545691).

Share and Enjoy

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

[1] Largely because iOS gets smarter about detected ‘broken’ Wi-Fi network as time goes by, and so you end up in an arms race with iOS itself.

@eskimo

Is "r. 20545691" the radar id requesting for that feature in WKWebView. If yes how can I track the status ?.

Accepted Answer

Is "r. 20545691" the radar id requesting for that feature in WKWebView.

Yes.

If yes how can I track the status ?.

You can’t directly. Your best option is to file a bug describing your requirements and noting that it should probably be dup’d to that bug. The standard bug system will then notify you when (well, I should say “if and when”) that bug gets resolved.

For this and other tips, see my Bug Reporting: How and Why? post.

Share and Enjoy

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

how to force WKWEBView or app to use WIFI over cellular
 
 
Q