iOS で Web サーバー上のファイル (HTML) の存在を検出する正しい方法は何でしょうか。以下を使用して myfile.html の存在を検出すると、常に true が返されます。
NSURL *url = [NSURL URLWithString:@"http://somewebsite.com/myfile.html"];
NSURLRequest *requestObject = [NSURLRequest requestWithURL:url];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:requestObject delegate:self];
if (theConnection) {
NSLog(@"File exists");
} else {
NSLog(@"File does NOT exist");
}
HTTPサーバーへの接続が成功したことを返し、ファイル myfile.html が実際に存在するかどうかを確認していないと思います。