狗尾草joss
狗尾草joss
  • 发布:2019-01-31 16:20
  • 更新:2020-04-26 14:28
  • 阅读:3705

本地打包测试mui,ajax请求部分手机一直abort,readyState=4,status=0

分类:MUI

mui.ajax('https://testeas.xhd.cn/api/appLogin/vali',{
data: dataObj,
dataType: 'json',
type: 'POST',
crossDomian:true,
timeout: 10000,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
success: function(data) {
if(data.result_code == 0) {
mui.openWindow({
url: 'index.html',
id: 'index'
})
}
},
error: function(xhr,type,errorThrown) {
var that = this
count++;
if(xhr.status == 404 && count <= 4) {
login();
}
console.log("readyState......" + xhr.readyState);
console.log("status......" + xhr.status);
console.log("statusText......" + xhr.statusText);
console.log("type......" + type);
var responseHost = xhr.getResponseHeader("Location");
alert("请求失败" + '------>' + type);
}
})
测试条件
1,https://testeas.xhd.cn 浏览器指定为不安全网站
2,大部分手机执行成功,小部分手机会报错
3,谷歌,火狐可以执行成功

2019-01-31 16:20 1 条评论 负责人:无 分享
已邀请:
狗尾草joss

狗尾草joss (作者)

问题已解决
解决方法,在IOS10以后网络应用请求会有权限设置,部分手机会自动弹框允许网络请求,部分手机需要自己手动设置
设置方法
IOS打开移动网络,向下拉点开自己的APP,开起网络权限

周厚勇

周厚勇

mui.ajax({
url: port,
data: params,
type: "POST",
dataType:'json',
cache:false,
headers:{"token":token},
})

IOS用HBuilderX打包之后 在苹果手机中会提示 readyState=4,status=404 error 但是 是偶尔提示,有时候没有,有时候出来, 在电脑端模拟的时候是没问题的 不知道什么原因 请指教

该问题目前已经被锁定, 无法添加新回复