Hello Matt,
I step across the same issue. I want to make an HTTP call to the server running in my local network. I added the NSLocalNetworkUsageDescription key both to my app target's Info.plist and my UITest target's Info.plist.
When running on physical device connected to the same network as the server: Sending the URLSession.dataTask() from the app brings the local network privacy prompt. If approved, the request is send and the approval is cached so it doesn't appear next time. All works fine - as expected.
Sending the URLSession.dataTask() from the UITest runner's XCTestCase does not bring the local network privacy prompt. The request never reaches the local server and URLSession.dataTask() results with the Error Domain=NSURLErrorDomain Code=-1009 "The internet connection appears to be offline." as reported by Ejnar.
I opened a ticket in Feedback Assistant: FB8983382 (Local Network Privacy Prompt is not received from an XCTestCase)
Would love to hear Apple Engineer's reply on this.
Is there any workaround for sending local requests from UITest runner?
Topic:
App & System Services
SubTopic:
Core OS
Tags: