"No route to host" error when accessing local network in an UI Test Runner app

Hi,

Background

My product has two components:
  1. An iPad app

  2. A separate hardware device. The hardware device creates an access point which the iPad connects to over Wi-Fi.

Some of my UI Tests access the local network from the UI Test runner app (not the app under test).

Prior to iPadOS 14/Xcode 12 I was able to access my device from the UI Test Runner app.

Problem

When I run on an iPad with iPadOS 14 installed, I get the following error:

Error Domain=NSPOSIXErrorDomain Code=65 "No route to host" UserInfo={NSLocalizedDescription=No route to host, NSLocalizedFailureReason=Error in connect() function}

This problem does not occur when I run the same test on an iPad running iPadOS 13. So this problem only occurs on iPads running iPadOS 14.

Theory

I watched the WWDC Session 10110 "Support local network privacy in your app" and it makes sense. My theory is that local network access is blocked for UI Test runner apps and there doesn't appear to be a way to give it permission.

If this theory is correct, can Apple provide a way to give local network access to UI Test runner apps? Or is something else going on?

Thank you.


I would like to echo the request here. Our developers run UI Tests which feed the app (being tested) data retrieved from a common local network host. That means the test methods (and helpers within the test project) are accessing the local network directly.

We could probably deal with it if, in fact, the Runner app provoked the Local Network Privacy system alert. That would interrupt and we could use an interruption monitor to see it. But based on my testing, Runner apps don't appear to provoke the system alert at all.

At the moment the only way around this seems to be putting the helper methods in the app itself and provoking them to run via UI gestures (taps and such). That would provoke the system alert. But for obvious reasons, putting such test code in to the app would be very undesirable.

Either....

a) allowing ui test runners to access local network resources without alerts; or
b) making ui test runners provoke the local network privacy alert like other apps

... would likely work for us. Or is there a setting I'm missing that is preventing the Runner app from provoking the system alert? The session task delegate is getting the "waiting" method called, so we know it gets at least that far.

Thank you.
I created FB8779076 (UI Test Runner app on iOS 14 device does not provoke Local Network Privacy system alert)

"No route to host" error when accessing local network in an UI Test Runner app
 
 
Q