A server with the specified hostname could not be found in AFNetworking

风流意气都作罢 提交于 2019-12-05 01:11:44

问题


I switch out AFnetworking API from ASIHTTPRequest in my app for connection error issues.

But now I'm getting connection error in AFNetworking. How can I resolve this?

Printing description of error: Error Domain=NSURLErrorDomain Code=-1003 "A server with the
specified hostname could not be found." UserInfo=0x1553bab0
{NSErrorFailingURLStringKey=https://example.com/oauth/token,
NSErrorFailingURLKey=https://example.com/oauth/token, NSLocalizedDescription=A server
with the specified hostname could not be found., NSUnderlyingError=0x1553b2c0 "A server
with the specified hostname could not be found."} (lldb) 

回答1:


Basically it's a server side issue. This error occur when your server is not responding or your server looks like in sleep mode.

I have also fetch this same issues many time. But, in my case when i switch to another WiFi network or Switch ON/OFF WiFi then it was automatically solved. Please try that and let us know your comments.

Thanks!




回答2:


I know this is an old thread, but I was also running into this problem. Resetting the device fixed the issue for me. I believe it may have something to do with DNS Pollution. I didn't have the issue after resetting so I couldn't keep testing, but I have read that turning on airplane mode and turning it off again works too.



来源:https://stackoverflow.com/questions/24994537/a-server-with-the-specified-hostname-could-not-be-found-in-afnetworking

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