mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-04-24 00:00:04 +08:00
Merge pull request #236 from maeldur/master
Fixed GCDWebServerGetPrimaryIPAddress() on tvOS devices
This commit is contained in:
@@ -267,8 +267,10 @@ NSString* GCDWebServerGetPrimaryIPAddress(BOOL useIPv6) {
|
|||||||
struct ifaddrs* list;
|
struct ifaddrs* list;
|
||||||
if (getifaddrs(&list) >= 0) {
|
if (getifaddrs(&list) >= 0) {
|
||||||
for (struct ifaddrs* ifap = list; ifap; ifap = ifap->ifa_next) {
|
for (struct ifaddrs* ifap = list; ifap; ifap = ifap->ifa_next) {
|
||||||
#if TARGET_IPHONE_SIMULATOR
|
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_TV
|
||||||
if (strcmp(ifap->ifa_name, "en0") && strcmp(ifap->ifa_name, "en1")) // Assume en0 is Ethernet and en1 is WiFi since there is no way to use SystemConfiguration framework in iOS Simulator
|
// Assume en0 is Ethernet and en1 is WiFi since there is no way to use SystemConfiguration framework in iOS Simulator
|
||||||
|
// Assumption holds for Apple TV running tvOS
|
||||||
|
if (strcmp(ifap->ifa_name, "en0") && strcmp(ifap->ifa_name, "en1"))
|
||||||
#else
|
#else
|
||||||
if (strcmp(ifap->ifa_name, primaryInterface))
|
if (strcmp(ifap->ifa_name, primaryInterface))
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user