GCDWebServer
GCDWebServer copied to clipboard
GCDWebServerGetPrimaryIPAddress is returning nil on iOS simulator with Ethernet connection
I am trying to fetch ip address using GCDWebServerGetPrimaryIPAddress
on iOS simulator while connected to Ethernet but it returns nil
. The same code is working fine when I am connected to wifi network. Here is my code.
NSString *ipAddress = GCDWebServerGetPrimaryIPAddress(NO);
NSAssert(ipAddress, @"We must have an IP address at this point to proceed");
I am using latest release of GCDWebServer v3.5.3.
I've attached screenshot of my ethernet connection.

Let me know if you need more information.
This function also returns nil
on a physical device if it is hotspotting (iPhone X running iOS 13.6). My workaround was to specify the GCDWebServerOption_BindToLocalhost
option (as I do not need to access the server externally).