I have a pretty straightforward code to connect to a given ip address and port using NWConnection. On the first attempt to connect to the Local Network I see the "Local Network Privacy" dialog and sometimes if I press "Don't Allow" on that dialog everything starts to fail. No matter I do I keep receiving the following error:
POSIXErrorCode(rawValue: 50): Network is down
Obviously going to settings and allowing local network access to the app doesn't fix the issue. Neither deleting the app and installing it again. The only workaround I found is to restart my device which is unacceptable for a user.
My code is really simple, I tried a lot of different approaches to connect but neither approach worked.
I am on iOS 18. Is it a known bug? could be possible a bug on my code?
Any idea would be really appreciated, thanks!