If url exists Objective-c

Posted by HiGuy Smith on Stack Overflow See other posts from Stack Overflow or by HiGuy Smith
Published on 2010-06-06T17:55:53Z Indexed on 2010/06/06 18:02 UTC
Read the original article Hit count: 470

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about image