We can receive udp within the Xcode debug however once published to TestFlight or store it no longer will receive data. We are using Cocoa Open Library GCDAsyncSocket. I will post code below.
We are very confused about the Local Network Privacy that has been added and the multicast entitlement. We are only receiving udp not broadcasting and also not multicasting. From my understanding the Local Network Privacy is not needed to just receive udp. The fact that it works in debug and not within TestFlight or Store makes me wonder if this is not the case and it's a permission issue. I added in the Local Privacy Network into the info.plist to verify and it still does not work. However I do not get a popup requesting permission nor do I see the app under the settings local privacy.
Is the local privacy network needed if you are only receiving udp not through bonjour services but through GCDAsyncSocket. Do I need to request the multicasting entitlement and how do I go about doing this?
This was working in 14.0.0 in the store version. It no longer works in 14.0.1
This is a small snipped of the code being used.
udpSocket = [[GCDAsyncUdpSocket alloc]initWithDelegate:self delegateQueue:dispatchgetmain_queue()];
NSError *error = nil;
if (![udpSocket bindToPort:GPSRecievePort error:&error])
{
NSString *ErrorMessage = [NSString stringWithFormat:@"ViewDidLoad : udp BindtoPort - %@", error];
ErrorMessage = [ErrorMessage stringByReplacingOccurrencesOfString:@"\"" withString:@""];
[self ErrorGPS:ErrorMessage];
NSLog(@"Error binding: %@", error);
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(Connect) userInfo:nil repeats:NO];
NSLog(@"GPS Reconnect");
GPSConnected = false;
return;
}
else
{
if(![udpSocket beginReceiving:&error])
{
NSString *ErrorMessage = [NSString stringWithFormat:@"ViewDidLoad : udp BindtoPort - %@", error];
}
}
I have not delved into the GCDAsyncUdpSocket library nor a network expert by any means. We are binding to a specific known port to listen. It is possible that this is maybe something underlining within the library we are using. This may not be a thing with NSConnection. I do agree with tts320 that maybe just binding to the port should trigger this dialog as well. It seems everything but the receive on unicast requires it. Also I didn't see a good way, similar to internal GPS, when the dialog appears handling a callback to know exactly if it was authorized or not. This may be different with NWConnection. I have not looked at that completely and is something we may move to in the future but currently just need it to work.
Thank you for your help and comments with this.