More explicit error message in case of nil completedBlock

NSParameterAssert doesn't provide enough information for understanding the API misuse.
Pointing the API user to SDWebImagePrefetcher makes more sense, as a nil completedBlock most likely signifies the intention of prefetching the image.
This commit is contained in:
Gabriele Petronella 2014-08-12 11:23:31 +02:00
parent 16eea9f104
commit ec6b6e7267
1 changed files with 1 additions and 1 deletions

View File

@ -112,7 +112,7 @@
progress:(SDWebImageDownloaderProgressBlock)progressBlock
completed:(SDWebImageCompletionWithFinishedBlock)completedBlock {
// Invoking this method without a completedBlock is pointless
NSParameterAssert(completedBlock);
NSAssert(completedBlock != nil, @"If you mean to prefetch the image, use -[SDWebImagePrefetcher prefetchURLs] instead");
// 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.