iOS UDP Multicast: Receiving works but sending silently fails

Hi everyone,

I’m working with UDP Multicasting on iOS (iOS 15+) using Network.framework and facing a confusing issue.

Setup:

  • Multicast IP: 239.255.0.1
  • Port: 45454
  • Using NWConnectionGroup / NWMulticastGroup
  • NSLocalNetworkUsageDescription is present in Info.plist
  • Devices are on the same Wi-Fi network

Problem:

  • Receiving multicast packets works perfectly
  • Sending multicast packets does NOT work
  • No errors are thrown
  • send() completion handler reports success
  • stateUpdateHandler sometimes doesn’t transition to .ready
  • No packets are actually transmitted on the network

Observations:

  • The app can receive data from other multicast senders
  • Sending appears to be silently blocked
  • Reinstalling the app fixes the issue
  • This points to a Local Network permission problem
  • If permission was denied once, iOS does not re-prompt
  • Inbound multicast works, outbound multicast is blocked

Questions:

  1. Is it expected on iOS that receiving multicast works even when sending is blocked?
  2. Is reinstalling the app the only way to recover if Local Network permission was denied?
  3. Is there any reliable runtime way to detect that outbound multicast is blocked?
  4. Is NWConnectionGroup the correct and only supported way to send multicast on iOS?

Any clarification or official guidance would really help. Thanks in advance!

I’m generally skeptical of using Network framework for multicasts. It should work in general, but:

  • There are a bunch of things it can’t do.
  • And even when it can, you often hit weird edge cases.

My general advice — and this makes me very sad — is to stick with BSD Sockets for broadcasts and multicasts. See Extra-ordinary Networking > Broadcasts and Multicasts, Hints and Tips.

Having said that, this is weird:

Reinstalling the app fixes the issue

This isn’t a standard pathology I see with Network framework’s multicast support and you are right to suspect local network privacy in that case. So let’s dig into that.

First up, you’ve signed your app with the the com.apple.developer.networking.multicast entitlement, right? You didn’t mention that, and it’s very important.

Share and Enjoy

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

iOS UDP Multicast: Receiving works but sending silently fails
 
 
Q