Reputation: 1061
I am using setImageWithURL:placeholderImage:options:andResize:withContentMode:success:
method of SDWebImage. When I provide it with correct URL, pointing to picture, it works well. But when I feed it some non-picture URL (e.g. http://www.yandex.ru), SDWebImage does nothing, even success and failure blocks are not called.
How should I detect if SDWebImage would not get image from the URL specified?
Upvotes: 1
Views: 1680
Reputation: 9354
Try to update SDWebImage to newest version and use new function instead of old:
sd_setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock
Upvotes: 1
Reputation: 11341
I'd recommend using the SDWebImageManager instead:
SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadWithURL:imageURL
options:0
progress:^(NSInteger receivedSize, NSInteger expectedSize)
{
// progression tracking code
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
{
if (image)
{
// do something with image
}
}];
And then check the error value in the completed block.
Upvotes: 1