1
나는 항상 다음 코드를 사용하여있는 UIWebView의 최신 캐시 된 복사본까지이 있는지 확인하기 위해 노력하고있어 : 내가 종료하지 않고 비행기 모드에 갈 때UIWebView 캐시 검색 중?
// Set URL to help file on server
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@", HELP_FILE_URL]];
// Check network reachability
wifiReach = [Reachability reachabilityWithHostName:[NSString stringWithFormat:@"%@", SERVER_URL]];
netStatus = [wifiReach currentReachabilityStatus];
// Start activity indicators
[self startAnimation];
// Verify current help file cache if we have network connection...
if (netStatus == ReachableViaWWAN || netStatus == ReachableViaWiFi) {
helpFileRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadRevalidatingCacheData timeoutInterval:30];
} else {
// Network NOT reachable - show (local) cache if it exists
helpFileRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReturnCacheDataDontLoad timeoutInterval:30];
}
// Show help file in a web view
[webView loadRequest:helpFileRequest];
그것은을 제외하고 대부분의 경우 잘 작동을 앱. 비행기 모드에서 캐싱 된 webView는 잘 보이지만 UIWebView 대리인
(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
도 내가 원하지 않는 트리거됩니다. 캐시가 비어있는 경우에만 트리거되도록하고 싶습니다! 어떻게하면 될까요? (응용 프로그램을 종료하면 제대로 작동합니다.) 작은 세부 사항이지만 제대로 작동하고 싶습니다.