我正在创建一个在Heroku上使用Rails API后端的iOS应用程序。定期(每20个API调用一个)找不到heroku。返回如下NSError:
Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0x755ce00 {NSErrorFailingURLStringKey=https://xxx.herokuapp.com/api/v1/matchups, NSErrorFailingURLKey=https://xxx.herokuapp.com/api/v1/matchups, NSLocalizedDescription=A server with the specified hostname could not be found., NSUnderlyingError=0x71ca730 "A server with the specified hostname could not be found."发布于 2013-07-15 21:14:03
看起来你正受到Dyno睡眠行为的影响。请查看this documentation,特别是Dyno 一节,并确保您理解它。此外,还有几种方法可以让应用程序保持打开,比如定期对网站执行like命令。
另一种选择是DNS,在你的计算机上创建一个点对点网络,并将你的iphone连接到该网络。使用wireshark捕获网络并分析DNS和HTTP响应。
发布于 2013-07-16 02:22:22
您的iPhone/iPad所连接的网络似乎存在DNS问题。要确保这一点,请尝试以下任一操作:
1)将主机名改为IP地址,而不是字符串hostname,并在HTTP请求中添加Host:头。
2)如果(1)很难,请将iPhone的DNS设置为LAN上的PC,并在该PC上安装DNS服务器,并且至少直接从PC提供该特定地址(不要为该域递归)。
发布于 2017-02-24 18:34:07
您的url = https://xxx.herokuapp.com/api/v1/matchups
您是否明确指定您的子域xxx与您的域提供商指向您的服务器IP?
如果没有,请尝试添加一个带有子域xxx指针的新A记录到您的服务器IP。
希望这能有所帮助。
https://stackoverflow.com/questions/17654664
复制相似问题