Merge pull request #665 from taichino/fix_backgrounding_task

Call endBackgroundTask at the end of start method
This commit is contained in:
Olivier Poitrey 2014-03-16 00:26:53 -07:00
commit 71de51d658
1 changed files with 7 additions and 0 deletions

View File

@ -108,6 +108,13 @@
self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}], YES);
}
}
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
if (self.backgroundTaskId != UIBackgroundTaskInvalid) {
[[UIApplication sharedApplication] endBackgroundTask:self.backgroundTaskId];
self.backgroundTaskId = UIBackgroundTaskInvalid;
}
#endif
}
- (void)cancel {