2011-11-18 85 views
1

我在Sencha Touch App中解析了來自服務器的JSON響應中的以下代碼。該應用被封裝在Phonegap中,並被部署爲本機應用蘋果手機。此代碼在iPhone模擬器上正常工作,但不在iPhone上。Sencha在iPhone模擬器中解析JSON,但不支持iPhone - phonegap

有一個類似的問題已經四處漫遊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 
}); 

任何幫助將非常感激。

回答

1

所以,我們設法修正這個錯誤...服務器是建立一個自定義,並在響應頭與HTTP響應/ 1.0,我們需要有HTTP/1.1

的小東西,大的影響。

謝謝!