Merge branch 'fix_downloader_crash_iOS8' into 5.x
This commit is contained in:
commit
5f85848aaa
|
@ -469,23 +469,7 @@ didReceiveResponse:(NSURLResponse *)response
|
||||||
if (!url) {
|
if (!url) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
Class operationClass = self.config.operationClass;
|
// Always pass YES to let URLSession or custom download operation to determine
|
||||||
if (!operationClass || [operationClass isSubclassOfClass:[SDWebImageDownloaderOperation class]]) {
|
|
||||||
// Built-in download operation class, checking all supported NSURLProtocol
|
|
||||||
NSURLRequest *request = [NSURLRequest requestWithURL:url];
|
|
||||||
NSArray<Class> *protocolClasses = self.sessionConfiguration.protocolClasses;
|
|
||||||
for (Class protocolClass in protocolClasses) {
|
|
||||||
if ([protocolClass isSubclassOfClass:[NSURLProtocol class]]) {
|
|
||||||
BOOL canLoad = [protocolClass canInitWithRequest:request];
|
|
||||||
if (canLoad) {
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
// Custom download operation class may not dependent on NSURLSession, always pass YES.
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue