Local Network privacy prompt for CFSocket

Does the new iOS 14's Local Network privacy prompt appear when a UDP connection is established using CFSocket?
I have not seen it in my tests with the app built with iOS 13 & 14 SDK. How should I proceed to trigger the prompt in this case?

Accepted Reply

The current state of affairs is that BSD Sockets code that listens on a UDP socket for traffic on the local network but never sends anything will not trigger the local network privacy alert. This is clearly suboptimal and we’re looking at ways to improve it. In the meantime you can work around the problem by sending some dummy data. The exact data you send doesn’t matter so I generally just send something from the UDP socket that I’m using to do the listen.

Share and Enjoy

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

Replies

So you’re sending data using CFSocketSendData?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
I use a plain old socket file descriptor. I suppose the CFSocket in the post title was misleading, I apologise. I don't ever send the data in the app, only receive it with recvfrom. Still, no prompt occurs and no data is received on iOS 14.

I don't ever send the data in the app, only receive it with
recvfrom.

Right. The local network privacy alerts are triggered by the send, and thus if you only receive you won’t see them.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
@DevilDimon have you filed a bug for this by any chance? Not being prompted on receipt (or even using NetworkReachability) breaks my app as well. Adding a SimplePing works, but seems unnecessary.
@Hydroplosion I submitted FB8699464 to track the issue.
Have you got any luck? I am stuck on the exact same stuff I just receive a UDP message that tells my app to which IP it should connect to for FTP transfer, now I am not getting it to work, it just stays there as I don't get any UDP message, but no local network popup is showing, I do only use the recvfrom function/method as well. @Hydroplosion, what's the SimplePing that you refer to?
@enan0sh SimplePing is Apple sample code I saw referenced by Quinn in other threads. Just to send something and get the permissions to appear.

@DevilDimon thank you!
What did you have to ping in order for the permission prompt to appear?
@divil5000 I am using a piece of hardware that creates its own network, so I just pinged the router iOS is connected to.
@devil5000 @DevilDimon did you got the issue figured out? I am not able to make the popup appear, I have my com.apple.developer.networking.multicast entitlement approved and everything but still my app does not appears on the local network privacy settings nor does the popup comes up, I don't get any UDP message on iOS 14 even with the entitlement. It was working fine on iOS 13.
As mentioned before, I am also using the recvfrom function to receive data.
  1. Do I still need to send anything to the server in order to get the privacy alert triggered (e.g. ping as discussed above)?

  2. Do I need to configure anything else other than adding NSLocalNetworkUsageDescription?

I am building the app with Xcode 11 without getting the privacy alert.
If I build the app with Xcode 12, the alert is not triggered, but data is received correctly.

Any help?


The current state of affairs is that BSD Sockets code that listens on a UDP socket for traffic on the local network but never sends anything will not trigger the local network privacy alert. This is clearly suboptimal and we’re looking at ways to improve it. In the meantime you can work around the problem by sending some dummy data. The exact data you send doesn’t matter so I generally just send something from the UDP socket that I’m using to do the listen.

Share and Enjoy

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