Unable to connect from IPv6 to IPv4 Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found

一世执手 提交于 2020-01-23 03:58:07

问题


I got the below error, while calling API from my iOS app (device) to server.

My device is connected to IPv6 network & API which i am calling is with IPv4 network. I created the app using swift and i am using Alamofire for calling API and Reachability for checking Internet connection. What should i do for this. Please suggest on the below error.

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}}}

回答1:


Your application needs to check for both A and AAAA records in DNS. Even if the server only has an A record. If you are on an IPv6-only network the local DNS resolver will simulate the AAAA record and it will seem like you are convection to an IPv6 server from the app. The network will handle the IPv6-to-IPv4 conversion behind the scenes.



来源:https://stackoverflow.com/questions/38604742/unable-to-connect-from-ipv6-to-ipv4-error-domain-nsurlerrordomain-code-1003-a

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