iOS 14.5 can't receive UDP multicast/broadcast, even with entitlement?

I'm using GCDAsyncUdpSocket to build a Simple Services Discovery Protocol utility into my app. I bind one socket (ssdpSock) to port 1900, and another one (ssdpSendSock) to port 0, using an error-checked version of the following:
Code Block
[sock enableReusePort:YES error:&socketError];
[sock bindToPort:port error:&socketError];
[sock joinMulticastGroup:@"239.255.255.250" error:&socketError];
[sock enableBroadcast:TRUE error:&socketError];
[sock beginReceiving:&socketError];
This all runs without error.

I listen for any incoming UDP data:
Code Block
- (void)udpSocket:(GCDAsyncUdpSocket *)sock
didReceiveData:(NSData *)data
fromAddress:(NSData *)address
withFilterContext:(nullable id)filterContext {
NSString *theSock = @"unknown socket";
if (sock == _ssdpSock) theSock = @"_ssdpSock";
if (sock == _ssdpSendSock) theSock = @"_ssdpSendSock";
NSLog(@"%@ received from addr:%@ port:%d",
theSock,
[GCDAsyncUdpSocket hostFromAddress:address],
[GCDAsyncUdpSocket portFromAddress:address]);


I then send out SSDP queries on ssdpSendSock:
Code Block
[_ssdpSendSock sendData:queryStr toHost:@"239.255.255.250" port:1900 withTimeout:2 tag:1];

which I receive back, because they're broadcasts:
Code Block
_ssdpSock received from addr:192.168.0.2 port:59946
(192.168.0.2 is my sending iPhone's IP address).

and, when the device type I'm looking for exists on the local network, I get a reply from it back to ssdpSendSock:
Code Block
_ssdpSendSock received from addr:192.168.0.30 port:1900
(192.168.0.30 is the device I'm listening for).


So far, so good.

However, the devices I'm looking for, and anything else on the 'net talking SSDP/UPnP, also broadcast unsolicited status updates, which I normally receive on ssdpSock:

Code Block
_ssdpSock received from addr:192.168.0.30 port:60414
_ssdpSock received from addr:192.168.0.80 port:57546
_ssdpSock received from addr:192.168.0.3 port:59140

These are important, because that's how I can tell when a device comes online or disappears without explicitly querying for them.

And this all works fine on iOS versions prior to 14.5. On 14.5, I just don't see anything received on ssdpSock other than my initial queries.

I already have NSLocalNetworkUsageDescription and NSLocationUsageDescription set (since iOS 13); I get the "allow local network access" alert on first run; and Settings > Privacy > Local Network is confirmed as set for my app. So I applied for the com.apple.developer.networking.multicast
entitlement and was approved. I've set it up according to Quinn "the Eskimo!"'s excellent instructions for the New Process, and confirmed it's built into my app.

And I still don't see anything on ssdpSock, other than my initial queries!

Again, the same code works fine on iOS 9–13. It just falls down on iOS 14.5.

Additionally, the current App Store version of the app, using the same SSDP code but built with Xcode 12.4 or 12.3, seems to work fine when installed on 14.5. But building and running the code with Xcode 12, 12.2, and 12.4, after manually adding the iOS 14.5 device support files to those older versions of XCode, still fails on iOS 14.5.

What additional mystical incantations must I invoke on 14.5 to receive multicast messages from other devices on the local network?


Updating to iOS 14.6 RC 2 appears to solve the problem. Which is good, because I had run out of chicken entrails to read, and the usual “Eye of newt and toe of frog, Wool of bat and [here the forum software redacted a perfectly innocuous word] of dog…” potions just weren’t working for me... ;-)
Accepted Answer
Updating to iOS 14.6 RC 2 appears to solve the problem. Which is good, because I had run out of chicken entrails to read, and the usual “Eye of newt and toe of frog, Wool of bat and [here the forum software redacted a perfectly innocuous word] of dog…” potions just weren’t working for me... ;-)
Update a day later: current builds are now working in 14.5 (perhaps irrelevant now that 14.6 has been released, but interesting nonetheless). Is it possible that the multicast entitlement took a couple of days to "burn in"? Quinn mentions "wait a day, and try again" for the entitlement not being available for an Apple ID; I wonder if a similar delay occurred for the entitlement not working within the app, which a rebuild a day later fixed.

Quinn mentions "wait a day, and try again" for the entitlement not
being available for an Apple ID; I wonder if a similar delay occurred
for the entitlement not working within the app, which a rebuild a day
later fixed.

No, these are two very different things. My comment is about getting the multicast networking additional capability in the first place. Once you have the capability and use that to enable the entitlement in your product, it should be effectively as soon as you install that version of your product.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
iOS 14.5 can't receive UDP multicast/broadcast, even with entitlement?
 
 
Q