xcode NSURLConnection 以错误结束 - 1001
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50072160/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NSURLConnection finished with error - 1001
提问by Ran Ji
First, the url is unreachable, When the webview called loadRequest, it has two error messages.And the UIWebViewDelegate
didFailLoadWithError
couldn't be called.
第一,url不可达,webview调用loadRequest的时候,有两条错误信息,UIWebViewDelegate
didFailLoadWithError
无法调用。
NSURLConnection finished with error - code -1001
HTTP load failed (error code: -999 [1:89])
NSURLConnection 以错误结束 - 代码 -1001
HTTP 加载失败(错误代码:-999 [1:89])
NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://ip:port/index"] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5];
[self.webView loadRequest:request];
回答by Ran Ji
I didn't set webView.delegate, so the delegates didn't be called
我没有设置 webView.delegate,所以没有调用委托