瀏覽代碼

Merge pull request #3294 from emilyZhouwm/master

Fixed issue where download progress would not be reported in iOS 7
Kevin Harwood 9 年之前
父節點
當前提交
aa9b5f59aa
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      AFNetworking/AFURLSessionManager.m

+ 1 - 1
AFNetworking/AFURLSessionManager.m

@@ -222,7 +222,7 @@ typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id re
 }
 
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
-    if ([object isKindOfClass:[NSURLSessionTask class]]) {
+    if ([object isKindOfClass:[NSURLSessionTask class]] || [object isKindOfClass:[NSURLSessionDownloadTask class]]) {
         if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {
             self.downloadProgress.completedUnitCount = [change[@"new"] longLongValue];
         } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]) {