UIWebView: Why does the request not time out when using a non-existant hostname?

痴心易碎 提交于 2019-12-06 10:11:07

Use delegate method

webView:didFailLoadWithError:

Get the error from it. If the error code is

-1000 - Bad Url
-1001 - Request timed out
-1003 - Cannot find host
-1004 - Cannot connect to host
-1005 - Network connection lost
-1006 - NSLookupFailed

By checking this you can alert the user about the error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!