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

22,836

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!

Share:
22,836
2vision2
Author by

2vision2

Updated on July 09, 2022

Comments

  • 2vision2
    2vision2 almost 2 years

    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) 
    
  • Droppy
    Droppy almost 10 years
    What about if there is no network connection and the name server cannot be reached?
  • 2vision2
    2vision2 almost 10 years
    @mohit thanks for your reply. But same api in andriod its working fine that's why im confusing. Can you please give any ref for this issues
  • 2vision2
    2vision2 almost 10 years
    @Mohit after 2 to 3mins when tried once again its wokring fine .Some times only im getting this issue
  • Mohit
    Mohit almost 10 years
    Yes This is server side issue i have also faced many times :)
  • IOS Dev
    IOS Dev almost 9 years
    i am also getting exactly same issue its been a long time still not resolved. I cannot just say it's a server side issue because it works fine for Android also for website. I have issue only in IOS. If it's a server side issue , can you please give a hint whats it is about. Is this related to open connection for long time, gzip or what ? Please suggest !!
  • Dania Delbani
    Dania Delbani almost 8 years
    @ShwetaChauhan I am facing the same problem, did you solve it! the same link is working fine in Safari wherase I am getting 1003 error in my app any idea?
  • Sam
    Sam almost 6 years
    @MoMo is it still occurring? Try resetting your device, that worked for me