NSURLRequest timeOut handling
I've been reading some issues here with NSURLRequest timeOut, but I see no answer to my problem. Well, here it is: my NSURLRequest object works fine, but I need to show some alert to the user if the connection time out is higher to 3. And i dun know how to handle that timeout. Any help is really appreciate it.
NSURLRequest *requestOb开发者_开发百科j = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:3] ;
[webView setDelegate:self];
[webView loadRequest:requestObj];
Define a delegate for the web view -- add <UIWebViewDelegate>
in the @interface
definition of your view controller and then link it up in Interface builder
then add a method
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
// whatever you want to do if it times out (or some other error)
}
精彩评论