If url exists Objective-c
- by HiGuy Smith
Hey, I have a program that needs to tell if an online image exists, but the only way that I've gotten this to work is by loading the image in a NSData pointer and checking if the pointer exists.
- (BOOL)exists {
NSString *filePath = @"http://couleeapps.hostei.com/BottomBox.png";
NSURL *url = [NSURL URLWithString:filePath];
NSData *imageData = [NSData dataWithContentsOfURL:url];
if (imageData) {
return YES;
}
return NO;
}
This has worked for me, but my problem is that I have a very slow connection, and it takes forever to download the image. So my question is: is there a way to check if a image (say "http://couleeapps.hostei.com/BottomBox.png") is available without having to download it?
Help is much appreciated
HiGuy