I used the answer from woodmantech above, but changed it based on what I have seen on other similar questions here so that it does not download the whole file to see if it exists.
I changed NSURLRequest
to NSMutableURLRequest
, and added:
[request setHTTPMethod:@"HEAD"];
This seems to work fine. I am working on my first app, so no real experience yet. Thanks everyone.
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:5.0];
[request setHTTPMethod:@"HEAD"];
NSHTTPURLResponse* response = nil;
NSError* error = nil;
[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSLog(@"statusCode = %d", [response statusCode]);
[NSHTTPURLResponse localizedStringForStatusCode: [response statusCode]]
– Airway