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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:38:07  来源:igfitidea点击:

NSURLConnection finished with error - 1001

iosobjective-cxcodeuiwebview

提问by Ran Ji

First, the url is unreachable, When the webview called loadRequest, it has two error messages.And the UIWebViewDelegatedidFailLoadWithErrorcouldn't be called.

第一,url不可达,webview调用loadRequest的时候,有两条错误信息,UIWebViewDelegatedidFailLoadWithError无法调用。

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,所以没有调用委托