Failsafe a very common usage error (passing URL as NSString instead of NSURL)
This commit is contained in:
parent
e9d43e443a
commit
7c06b3a314
|
@ -73,6 +73,13 @@ static SDWebImageManager *instance;
|
|||
return;
|
||||
}
|
||||
|
||||
// Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, XCode won't
|
||||
// throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString.
|
||||
if ([url isKindOfClass:NSString.class])
|
||||
{
|
||||
url = [NSURL URLWithString:(NSString *)url];
|
||||
}
|
||||
|
||||
// Check the on-disk cache async so we don't block the main thread
|
||||
[cacheDelegates addObject:delegate];
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:delegate, @"delegate", url, @"url", [NSNumber numberWithBool:lowPriority], @"low_priority", nil];
|
||||
|
|
Loading…
Reference in New Issue