GCDWebServer icon indicating copy to clipboard operation
GCDWebServer copied to clipboard

GCDWebServerGetPrimaryIPAddress is returning nil on iOS simulator with Ethernet connection

Open bhaveshagrawal1014 opened this issue 5 years ago • 1 comments

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.

Screenshot 2020-01-03 at 11 50 45 AM

Let me know if you need more information.

bhaveshagrawal1014 avatar Jan 03 '20 06:01 bhaveshagrawal1014

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).

diachedelic avatar Jul 30 '20 01:07 diachedelic