Skip to content

Commit 71de51d

Browse files
author
Olivier Poitrey
committed
Merge pull request SDWebImage#665 from taichino/fix_backgrounding_task
Call endBackgroundTask at the end of start method
2 parents 938c2e0 + efb0b35 commit 71de51d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

SDWebImage/SDWebImageDownloaderOperation.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ - (void)start {
108108
self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}], YES);
109109
}
110110
}
111+
112+
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
113+
if (self.backgroundTaskId != UIBackgroundTaskInvalid) {
114+
[[UIApplication sharedApplication] endBackgroundTask:self.backgroundTaskId];
115+
self.backgroundTaskId = UIBackgroundTaskInvalid;
116+
}
117+
#endif
111118
}
112119

113120
- (void)cancel {

0 commit comments

Comments
 (0)