Skip to content

Commit 8a6a139

Browse files
committed
Merge pull request swisspol#236 from maeldur/master
Fixed GCDWebServerGetPrimaryIPAddress() on tvOS devices
2 parents 4eba86f + 062a0dc commit 8a6a139

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

GCDWebServer/Core/GCDWebServerFunctions.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ BOOL GCDWebServerIsTextContentType(NSString* type) {
267267
struct ifaddrs* list;
268268
if (getifaddrs(&list) >= 0) {
269269
for (struct ifaddrs* ifap = list; ifap; ifap = ifap->ifa_next) {
270-
#if TARGET_IPHONE_SIMULATOR
271-
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
270+
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_TV
271+
// Assume en0 is Ethernet and en1 is WiFi since there is no way to use SystemConfiguration framework in iOS Simulator
272+
// Assumption holds for Apple TV running tvOS
273+
if (strcmp(ifap->ifa_name, "en0") && strcmp(ifap->ifa_name, "en1"))
272274
#else
273275
if (strcmp(ifap->ifa_name, primaryInterface))
274276
#endif

0 commit comments

Comments
 (0)