Use NSDictionary syntatic sugar

This commit is contained in:
zhongwuzw 2018-07-24 13:05:12 +08:00
parent 532a4d8229
commit 2b7b5f5fa2
1 changed files with 2 additions and 6 deletions

View File

@ -134,11 +134,7 @@ static void * SDWebImageDownloaderContext = &SDWebImageDownloaderContext;
return;
}
NSMutableDictionary *mutableHTTPHeaders = [self.HTTPHeaders mutableCopy];
if (value) {
[mutableHTTPHeaders setObject:value forKey:field];
} else {
[mutableHTTPHeaders removeObjectForKey:field];
}
[mutableHTTPHeaders setValue:value forKey:field];
self.HTTPHeaders = [mutableHTTPHeaders copy];
}
@ -272,7 +268,7 @@ static void * SDWebImageDownloaderContext = &SDWebImageDownloaderContext;
[sself.URLOperations removeObjectForKey:url];
UNLOCK(sself.operationsLock);
};
[self.URLOperations setObject:operation forKey:url];
self.URLOperations[url] = operation;
// Add operation to operation queue only after all configuration done according to Apple's doc.
// `addOperation:` does not synchronously execute the `operation.completionBlock` so this will not cause deadlock.
[self.downloadQueue addOperation:operation];