I was able to solve this using the answer provided by sirlantis here: https://discussions.apple.com/thread/251846639?answerId=251846639021#251846639021
Post
Replies
Boosts
Views
Activity
Hi Matt,
Thank you for your response.
I have tried only setting the NSLocalNetworkUsageDescription key in my test target's Info.plist (no more entries for NSBonjourServices or NSAllowsArbitraryLoads). My test code now simply executes a URLSession.dataTask to a local endpoint via http. However, I do not get the local network usage prompt when running the test, and the network call fails with the same error as before. I removed the test app before running to make sure the value was not cached.
Can you tell me what code you wrote in your test that triggered the prompt? And just to be sure: the prompt will be triggered by the test app, not the actual app under test, right? Also, the Info.plist of the app under test can remain untouched?
Kind regards,
Ejnar