Authored by Matsumoto Taichi

SDWebImageDownloaderOperation: call endBackgroundTask after operation is finishe…

…d so that beginBackgroundTaskWithExpirationHandler and endBackgroundTask are balanced
@@ -108,6 +108,13 @@ @@ -108,6 +108,13 @@
108 self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}], YES); 108 self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}], YES);
109 } 109 }
110 } 110 }
  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
111 } 118 }
112 119
113 - (void)cancel { 120 - (void)cancel {