UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]]];
I use the code above and then check
if (image)
return image;
else
{
NSLog(@"no image on URL");
return nil;
}
But sometimes (very very seldom) I don't get an image from a valid url. The url is valid 100%.
Usually it takes nearly one second to load a picture, but when it can't load a picture the process takes much more time (20-200 seconds). And then i get "no image on URL".
Is there a better way to get a picture from URL? I'd rather get "no image on URL" in one second then waiting so long.
P.S. srry for my poor english