我在Sencha Touch App中有以下代码,用于解析来自服务器的JSON响应。该应用程序包含在Phonegap中,并在iPhone上部署为本机应用程序。此代码在iPhone模拟器上运行良好,但在iPhone本身上无效。
有一个类似的问题已经在SO周围漫游,未得到答复:json not loading in iphone device while using sencha touch and phonegap
Ext.Ajax.request({
url: makeurl, //'http://hostname/index.php?id=1234&action=STARTLIST&cmd=0',
scope : this,
success: function(response){
GoRemote.views.devicelist.setLoading(false);
GoRemote.serverstatus="Ok";
Ext.getCmp('serverstatuspanel').update('Server Status : Okay');
this.listData = Ext.decode(response.responseText);
console.log(response);
if (this.listData.listresponse) {
GoRemote.stores.RoomDeviceListStore.loadData(this.listData.listresponse.listdata, false);
GoRemote.views.toolbar.setTitle(this.listData.listresponse.listinfo.listname);
if(this.listData.listresponse.listinfo.container){
Ext.getCmp('btnBack').setVisible(true);
}
else{
Ext.getCmp('btnBack').setVisible(false);
}
}
else if(this.listData.listcontrol){
if(this.listData.listcontrol.controlinfo.name=="NIAVDevice"){
Ext.getCmp('navigation').setActiveItem(0);
}
}
},
failure:function(response){
GoRemote.serverstatus="Unable to reach director";
Ext.getCmp('serverstatuspanel').update('Server Status : Unable to reach director');
GoRemote.views.devicelist.setLoading(false);
}
// timeout:20000
});
非常感谢任何帮助。
答案 0 :(得分:1)
所以,我们设法修复错误......服务器是自定义构建的,并且响应标头响应HTTP / 1.0,我们需要HTTP / 1.1
小事,影响很大。
谢谢!