From 653dfb727b9a101d97b1c98b42d2d8444cf081d4 Mon Sep 17 00:00:00 2001 From: Thomas Mellenthin Date: Wed, 13 Mar 2019 15:26:52 +0100 Subject: [PATCH] Allow to build and run GDWebServer in app extensions. --- GCDWebServer/Core/GCDWebServer.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GCDWebServer/Core/GCDWebServer.m b/GCDWebServer/Core/GCDWebServer.m index 0b75557..e64c71e 100644 --- a/GCDWebServer/Core/GCDWebServer.m +++ b/GCDWebServer/Core/GCDWebServer.m @@ -198,7 +198,7 @@ static void _ExecuteMainThreadRunLoopSources() { #endif } -#if TARGET_OS_IPHONE +#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION // Always called on main thread - (void)_startBackgroundTask { @@ -223,7 +223,7 @@ static void _ExecuteMainThreadRunLoopSources() { _connected = YES; GWS_LOG_DEBUG(@"Did connect"); -#if TARGET_OS_IPHONE +#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) { [self _startBackgroundTask]; } @@ -253,7 +253,7 @@ static void _ExecuteMainThreadRunLoopSources() { }); } -#if TARGET_OS_IPHONE +#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION // Always called on main thread - (void)_endBackgroundTask { @@ -277,7 +277,7 @@ static void _ExecuteMainThreadRunLoopSources() { _connected = NO; GWS_LOG_DEBUG(@"Did disconnect"); -#if TARGET_OS_IPHONE +#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION [self _endBackgroundTask]; #endif @@ -726,7 +726,7 @@ static inline NSString* _EncodeBase64(NSString* string) { - (BOOL)startWithOptions:(NSDictionary*)options error:(NSError**)error { if (_options == nil) { _options = options ? [options copy] : @{}; -#if TARGET_OS_IPHONE +#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION _suspendInBackground = [(NSNumber*)_GetOption(_options, GCDWebServerOption_AutomaticallySuspendInBackground, @YES) boolValue]; if (((_suspendInBackground == NO) || ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground)) && ![self _start:error]) #else