2016-11-09 38 views
0

这是在Safari浏览器的iOS 10科尔多瓦发生:6.3.1

请求采用了棱角分明的$ HTTP,误差函数不叫

$http.get("http://10.255.255.1").then(function(res){ 
    console.log("res: " + res); 
},function(err){ 
    console.log("err: " + err); 
}); 

Promise {$$state: {status: 0}, then: function, catch: function, finally: function} 

控制台:加载资源失败:请求超时。 (10.255.255.1,线0)使用的XMLHttpRequest


请求捕捉超时错误

var xhr = new XMLHttpRequest(); xhr.onload = function() { 
    console.log("request finished") 
}; 
xhr.ontimeout = function (e) { 
    console.log("request timeout") 
}; 
xhr.open('GET', 'http://10.255.255.1', true); 
xhr.send(null); 

控制台:请求超时

供参考: http://10.255.255.1是,我使用到一个URL测试超时。 来源:Artificially create a connection timeout error

+0

仅供参考:已在Angular中修复此问题,修复程序将包含在版本1.5.9和1.6.0-rc.0中。另见https://github.com/angular/angular.js/issues/15380。 – gkalpak

回答

0

即使增加超时,60秒后XMLHttpRequest仍会引发错误。

所以这是一个iOS 10 WebView的东西,我认为这是不可配置的。

在Angular中,如果提供的超时属性少于60秒,则会错误地引发错误。

看起来像Angular中的一个bug。在WebView请求超时之后它仍应该抛出错误。

+0

https://openradar.appspot.com/28810194是关于它的radr问题和https://bugs.webkit.org/show_bug.cgi?id=163814 webkit中的修复 – EionRobb