Sencha解析JSON在iphone模拟器,但不是在iphone - phonegap



我在Sencha Touch应用程序中有以下代码,解析来自服务器的JSON响应。这款应用围绕Phonegap展开,并作为iPhone的原生应用部署。这段代码在iPhone模拟器上运行良好,但不能在iPhone上运行。

有一个类似的问题已经漫游SO,没有答案:json不能在iphone设备上加载,而使用sencha touch和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

小事情,大影响。

谢谢!

最新更新