Someone opened a TSI about this, which brought this thread to my attention. Sorry I didn’t reply sooner. The original tags for this thread weren’t ones that I monitor.
To start, I want to be clear that this is about the macOS firewall (System Settings > Network > Firewall), not iOS’s Local Network Privacy feature. When you run on the simulator you use macOS’s networking stack, and thus you’re affected by its firewall configuration.
The macOS firewall identifies a program via its designated requirement (DR). This is a code signing construct that allows the system to know that version N+1 of the program is the ‘same code’ as version N. You can learn more about it in TN3127 Inside Code Signing: Requirements.
The problem is that an iOS app running in the simulator doesn’t have a stable DR. Such an app is ad hoc signed [1], and thus its DR changes from build to build.
The easiest way around this is to disable the macOS firewall in System Settings > Network > Firewall. IMO the firewall doesn’t offer a lot of value because modern threats all centre around outgoing connections, not incoming ones (although I recognise that other folks disagree).
If that’s not an option then your next best option to turn around your network connections. Rather than have your (simulated) iOS code listen for connections, having it make an outgoing connection. Such outgoing connections are not blocked by the firewall.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] In Xcode parlance this is called Signed to Run Locally. Note that ad hoc signing is different from iOS’s Ad Hoc distribution method.