0
인터넷 연결 여부를 확인하기 위해 다음을 사용하는 앱이 있습니다. 확인하는 데 걸리는 시간을 제한 할 수있는 방법이 있습니까? 무선 연결이 약한 경우 앱이 확인하는 데 시간이 걸릴 수 있습니다.iPad 앱의 인터넷 연결 확인 시간 제한
- (BOOL)connectedToInternet
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: [NSURL URLWithString:@"http://www.google.com/"]];
[request setHTTPMethod:@"HEAD"];
NSHTTPURLResponse *response;
[NSURLConnection sendSynchronousRequest:request returningResponse:&response error: NULL];
return ([response statusCode] == 200) ? YES : NO;
}
감사합니다. – RGriffiths