I'm using a UIWebView
to load a static resource shipped within my application bundle. Sometimes, I have no clear what the problem could be, I receive the following error within the delegate method - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1001
The resource is loaded through a NSURLRequest
where I set up a timeout interval of 10 seconds, but that interval is not followed. In fact, in the debug console I'm able to see that the error delegate is called after about 2 seconds.
NSURL *htmlFile = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"root" ofType:@"html"] isDirectory:NO];
NSURLRequest* htmlRequest = [NSURLRequest requestWithURL:htmlFile cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10.0];
[webView loadRequest:htmlRequest];
The fact is that I cannot always replicate the problem I have. Any suggestions?
P.S. I'm working with an app that runs from 4.3. The problem is also with iOS 7.