Sencha在iPhone模拟器中解析JSON,但不是在iPhone - phonegap [英] Sencha parses JSON in iphone simulator, but not on iPhone - phonegap
问题描述
我在Sencha Touch应用程序中有以下代码来解析来自服务器的JSON响应。应用程序包装在Phonegap周围,并作为iPhone上的本机应用程序部署。
I have the following code in a Sencha Touch App that parses a JSON response from the server.The app is wrapped around Phonegap and being deployed as a native app on the iPhone. This code works fine on the iPhone Simulator but not on the iPhone itself.
有一个类似的问题已经在SO上漫游,没有回答:json不使用sencha touch和phonegap时在iPhone设备中加载
There's a similar question already roaming around SO, unanswered: 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
});
任何帮助将非常感激。
推荐答案
所以,我们设法修复错误...服务器是一个自定义构建,在响应标头响应与HTTP / 1.0,我们需要有HTTP / 1.1
So, we managed to fix the error... The server was a custom built and in the Response Headers was responding with HTTP/1.0 where we needed to have HTTP/1.1
小小的东西,很大的影响。
Little thing, big impact.
谢谢!
这篇关于Sencha在iPhone模拟器中解析JSON,但不是在iPhone - phonegap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!