我在这里读到了一些关于NSURLRequest timeOut的问题,但我看不到解决我的问题的答案。好吧,这里是:我的NSURLRequest对象运行良好,但是如果连接超时超过3,我需要向用户显示一些警告,而我不知道如何处理这个超时。任何帮助都是非常感谢的。
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:3] ;
[webView setDelegate:self];
[webView loadRequest:requestObj];发布于 2011-03-24 00:19:45
为web视图定义一个委托--在视图控制器的@interface定义中添加<UIWebViewDelegate>,然后在接口构建器中将其链接起来
然后添加一个方法
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
// whatever you want to do if it times out (or some other error)
}https://stackoverflow.com/questions/5408022
复制相似问题