2vision2
2vision2

Reputation: 5023

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

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) 

Upvotes: 4

Views: 26879

Answers (2)

Sam
Sam

Reputation: 956

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.

Upvotes: 0

Mohit
Mohit

Reputation: 516

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!

Upvotes: 5

Related Questions