【发布时间】:2011-08-11 15:14:12
【问题描述】:
我有一个 UIViewController,它是一个 UIWebViewDelegate,里面有一个 UIWebView。我正在尝试加载特定的 URL
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[self.view addSubview:webView];
[webView release];
但是didFailLoadWithErrordelegate 方法几乎是立即被调用,错误对象是:
Did fail load with error: Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x1a66c0 {NSErrorFailingURLKey=www.somewebsite.com, NSErrorFailingURLStringKey=www.somewebsite.com}
但是不久之后,您可以看到网站加载正常。
为什么调用fail方法?以及无论网站是否实际失败,我如何知道它何时实际失败以及何时调用该方法?
【问题讨论】:
-
我遇到了同样的错误,因为我第一次使用 url,第二次加载 url1。也许它会对任何人都有帮助。
标签: iphone xcode ipad uiwebview