简体   繁体   English

Sencha在iPhone模拟器中解析JSON,但在iPhone上无法解析-PhoneGap

[英]Sencha parses JSON in iphone simulator, but not on iPhone - phonegap

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. 我在Sencha Touch应用程序中有以下代码,该代码解析来自服务器的JSON响应。该应用程序围绕Phonegap封装,并作为本机应用程序部署在iPhone上。 This code works fine on the iPhone Simulator but not on the iPhone itself. 这段代码在iPhone Simulator上可以正常工作,但在iPhone本身上不能正常工作。

There's a similar question already roaming around SO, unanswered: json not loading in iphone device while using sencha touch and phonegap 有一个类似的问题已经围绕SO漫游, 但未得到解答: 使用sencha touch和phonegap时json无法加载到iphone设备中

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
});

Any help will be much appreciated. 任何帮助都感激不尽。

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 因此,我们设法解决了该错误...服务器是自定义构建的,并且在响应标头中使用HTTP / 1.0进行响应,而我们需要使用HTTP / 1.1

Little thing, big impact. 小事,大影响。

Thanks! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM