From 305c974b8b2e78da8bdfe49a9f4feed7b64f5f8c Mon Sep 17 00:00:00 2001 From: Wenbin Zhang Date: Fri, 26 Feb 2016 12:24:45 -0800 Subject: [PATCH] Use `NSKeyValueChangeNewKey` in change dictionary. * We explicitly used @"new" in `change`, I think it's better to use platform defined constant. --- AFNetworking/AFURLSessionManager.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AFNetworking/AFURLSessionManager.m b/AFNetworking/AFURLSessionManager.m index f06720c9ca..c345a040eb 100644 --- a/AFNetworking/AFURLSessionManager.m +++ b/AFNetworking/AFURLSessionManager.m @@ -224,13 +224,13 @@ - (void)cleanUpProgressForTask:(NSURLSessionTask *)task { - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([object isKindOfClass:[NSURLSessionTask class]] || [object isKindOfClass:[NSURLSessionDownloadTask class]]) { if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { - self.downloadProgress.completedUnitCount = [change[@"new"] longLongValue]; + self.downloadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue]; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]) { - self.downloadProgress.totalUnitCount = [change[@"new"] longLongValue]; + self.downloadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue]; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { - self.uploadProgress.completedUnitCount = [change[@"new"] longLongValue]; + self.uploadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue]; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]) { - self.uploadProgress.totalUnitCount = [change[@"new"] longLongValue]; + self.uploadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue]; } } else if ([object isEqual:self.downloadProgress]) {