UIWebview를로드하고로드를 완료하는 데 약간의 시간이 소요될 수 있습니다. 요청이 시작되어 데이터 수신을 시작합니다. 그러나 요청이 완료된 것으로 나타나지 않습니다. webViewDidFinishLoad는 결코 호출하지 않으며 webView didFailLoadWithError : callback도하지 않습니다.데이터로드가 시작되지만 webViewDidFinishLoad가 아닌 경우 NSMutableURLRequest 시간 초과가 트리거되지 않습니다.
NSURLRequest의 시간 초과는 데이터를 수신하는 응답이 없거나 해당 간격에서도 요청이 완료되지 않으면 트리거됩니까?
이전 버전 인 경우 요청을 시간 초과 할 수있는 우아한 해결책이 있습니까?
관련 코드는 다음과 같습니다
로드 요청 :
- (void) loadRequest { NSString *targetURL = @" http://myrequestUrl/ "; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: targetURL] cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval: 15.0] autorelease];
[request setHTTPBasicID: [[self credentialManager] userID] password:[[self credentialManager] password]];
[webView loadRequest:request];
대표는
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible: NO]; [alert hide]; [alert autorelease]; alert = nil; NSLog(@"error - %@", error); [self showRetryPrompt: error];
}