Skip to content

Commit a3606d6

Browse files
committed
Don't start a background task while the app is already in background
1 parent 00b2c38 commit a3606d6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

GCDWebServer/Core/GCDWebServer.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ - (void)_didConnect {
244244
GWS_LOG_DEBUG(@"Did connect");
245245

246246
#if TARGET_OS_IPHONE
247-
[self _startBackgroundTask];
247+
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
248+
[self _startBackgroundTask];
249+
}
248250
#endif
249251

250252
if ([_delegate respondsToSelector:@selector(webServerDidConnect:)]) {

0 commit comments

Comments
 (0)