Skip to content

Commit 8d0a359

Browse files
authored
Merge pull request swisspol#416 from melle/app-extensions
Allow to build and run GDWebServer in app extensions.
2 parents 7e4dd53 + 653dfb7 commit 8d0a359

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

GCDWebServer/Core/GCDWebServer.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ - (void)dealloc {
198198
#endif
199199
}
200200

201-
#if TARGET_OS_IPHONE
201+
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
202202

203203
// Always called on main thread
204204
- (void)_startBackgroundTask {
@@ -223,7 +223,7 @@ - (void)_didConnect {
223223
_connected = YES;
224224
GWS_LOG_DEBUG(@"Did connect");
225225

226-
#if TARGET_OS_IPHONE
226+
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
227227
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
228228
[self _startBackgroundTask];
229229
}
@@ -253,7 +253,7 @@ - (void)willStartConnection:(GCDWebServerConnection*)connection {
253253
});
254254
}
255255

256-
#if TARGET_OS_IPHONE
256+
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
257257

258258
// Always called on main thread
259259
- (void)_endBackgroundTask {
@@ -277,7 +277,7 @@ - (void)_didDisconnect {
277277
_connected = NO;
278278
GWS_LOG_DEBUG(@"Did disconnect");
279279

280-
#if TARGET_OS_IPHONE
280+
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
281281
[self _endBackgroundTask];
282282
#endif
283283

@@ -726,7 +726,7 @@ - (void)_willEnterForeground:(NSNotification*)notification {
726726
- (BOOL)startWithOptions:(NSDictionary<NSString*, id>*)options error:(NSError**)error {
727727
if (_options == nil) {
728728
_options = options ? [options copy] : @{};
729-
#if TARGET_OS_IPHONE
729+
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
730730
_suspendInBackground = [(NSNumber*)_GetOption(_options, GCDWebServerOption_AutomaticallySuspendInBackground, @YES) boolValue];
731731
if (((_suspendInBackground == NO) || ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground)) && ![self _start:error])
732732
#else

0 commit comments

Comments
 (0)