NWConnection and "Network is Down" error connecting to ip address and port

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!

could be possible a bug on my code?

That’s doesn’t seem likely. You shouldn’t have to restart your device for iOS to recognise local network privacy changes, regardless of how you wrote your code.

Are you able to test on a different device? If so, do you see the same problem there?

Does the problem reproduce with a small test app?

Is there any chance your app has a main executable UUID that’s not unique? For more on that, see the Build-time considerations section of TN3179 Understanding local network privacy.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hey @jpgarcia80 / @DTS Engineer just wanted to +1 this thread, we have recently implemented an ethernet connection and find that if the user denies Local Network permission, "everything fails" and the device must be rebooted for any changes to get recognized. We also see "Network is Down", and the issues persist through app deletions and re-installations.

We have iPhone 15's we're testing with, and we compared them to see if there's any differences - there doesn't seem to be. Same OS, same model iPhone, same app build, bug only presents on some phones and not others, seemingly by random.

Starting to wonder if this is an issue in iOS 18.X.

Hey Quinn / @DTS Engineer , question regarding the Mach-O UUID scenario here:

Let's say we have app variants for each of our environments, Dev, QA, Production.

The intent is that nobody should have more than one of these variants installed at any given time.

I just ran the dwarfdump, and found that these variants are producing the same UUID values, but is that an issue for this scenario? Your example is for when users might have a Pro and Lite version installed simultaneously, so this scenario is a bit different.

Would iOS care if different environment variants of the same app used the same UUID, even if those are only installed one at a time?

Let's say we have app variants for each of our environments, Dev, QA, Production.

Do they have the same bundle ID?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

NWConnection and "Network is Down" error connecting to ip address and port
 
 
Q