Failed to connect from IPv6 to IPv4 Domain Error = NSURLErrorDomain Code = -1003 "Server with the specified hostname was not found

I got the following error when calling the API from my iOS application (device) to the server.

My device is connected to an IPv6 network and the API that I am calling is with an IPv4 network. I created the application using swift, and I use Alamofire to call the API and Reachability to check my internet connection. What should I do for this. Please suggest an error below.

Request failed with error: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo= {NSErrorFailingURLStringKey=, _kCFStreamErrorCodeKey=8, NSErrorFailingURLKey=, NSLocalizedDescription=A server with the specified hostname could not be found., _kCFStreamErrorDomainKey=12, NSUnderlyingError=0x7a08c530 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo= {_kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8}}} 
0
ios swift ipv4 ipv6 alamofire
Jul 27 '16 at 5:53
source share
1 answer

Your application should check both A and AAAA records in DNS. Even if the server has only an A. entry. If you are on the network with IPv6 only, the local DNS resolver will mimic the AAAA record and it will look like you are convection to the IPv6 server from the application. The network will handle the IPv6-IPv4 conversion behind the scenes.

+2
Jul 27 '16 at 9:35
source share



All Articles