Xcode 16(SDK ios18) "No route to host"

How can I resolve the error(Code=65 "No route to host).

Xcode 16(SDK ios18): We invoke GCDAsyncUdpSocket to send UDP data to the broadcast address,then get Error Domain=NSPOSIXErrorDomain Code=65 "No route to host"

Xcode 16.1 beta 2(SDK ios18.1): We invoke GCDAsyncUdpSocket to send UDP data to the broadcast address,then it work fine.

Xcode 15.4(SDK ios17.5): We invoke GCDAsyncUdpSocket to send UDP data to the broadcast address,then it work fine.

Notes: Privacy - Local Network Usage Description and the multicast entitlement has been added. Bonjour services has been added _http._tcp、_http._udp

Code:

 GCDAsyncUdpSocket *gcdUdpSearchSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];

NSError *error = nil;
if (![gcdUdpSearchSocket enableBroadcast:YES error:&error]){
    NSLog(@"gcdUdpSearchSocket enableBroadcast Error binding: %@", error);
    return;
}

if (![gcdUdpSearchSocket bindToPort:UDP_PORT error:&error])
{
    NSLog(@"GCDUdp Error binding: %@", error);
    return;
}

if (![gcdUdpSearchSocket beginReceiving:&error])
{
    NSLog(@"GCDUdp Error receiving: %@", error);
    return;
}
Answered by DTS Engineer in 805054022

Answering questions like this is hard because you have multiple factors in play:

  • Your third-party library

  • The Xcode version, and hence the iOS SDK version

  • The iOS version

  • The individual devices you’re testing on

I recommend that you try to isolate some of these factors:

  • Re-create the problem without using your third-party library. I recommend that you build a small test app that calls BSD Sockets directly [1].

  • Isolate the Xcode / iOS SDK version by building your test app with Xcode 15 and then running exactly the same app binary on iOS 17, iOS 18, and the iOS 18.1 beta.


Having said that, the vast majority of problems I see in this space are caused by one of the following:

Share and Enjoy

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

[1] You’re using Objective-C, so calling BSD Sockets is relatively straightforward. If anyone else is reading along and they’re using Swift, a good place to start with a test project is the QSocket code referenced by Extra-ordinary Networking.

Answering questions like this is hard because you have multiple factors in play:

  • Your third-party library

  • The Xcode version, and hence the iOS SDK version

  • The iOS version

  • The individual devices you’re testing on

I recommend that you try to isolate some of these factors:

  • Re-create the problem without using your third-party library. I recommend that you build a small test app that calls BSD Sockets directly [1].

  • Isolate the Xcode / iOS SDK version by building your test app with Xcode 15 and then running exactly the same app binary on iOS 17, iOS 18, and the iOS 18.1 beta.


Having said that, the vast majority of problems I see in this space are caused by one of the following:

Share and Enjoy

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

[1] You’re using Objective-C, so calling BSD Sockets is relatively straightforward. If anyone else is reading along and they’re using Swift, a good place to start with a test project is the QSocket code referenced by Extra-ordinary Networking.

Xcode 16(SDK ios18) "No route to host"
 
 
Q