2013-04-09 90 views
0

我一直在使用phonegap開發一個android應用程序。在應用程序中,我使用了xmlrpcrequest請求。有時,當我提出請求,可能是由於連接速度慢,請求超時,我得到以下錯誤WebUrlLoaderClient:同步請求超時後10

E/WebUrlLoaderClient(574):同步請求10秒0號超時後嘗試

反正有「趕上」這個錯誤,或者可能增加超時時間?

+0

在這裏看到:http://stackoverflow.com/a/21882438/975443 – Kozuch 2014-02-19 13:51:45

回答

0

我有這個相同的問題,因爲我更新到phonegap 2.8.1,你使用什麼版本? 它似乎並沒有聽AJAX超時參數都:

var dataObj = { 'value': whatever'}; 
     //navigator.notification.alert(JSON.stringify(dataObj)); 
     $.ajax({ 
      type: 'POST', 
      url: url, 
      async: false, 
      data: JSON.stringify(dataObj), 
      dataType: 'json', 
      timeout: 25000, 
      contentType: 'application/json; charset=utf-8', 
      crossDomain: true, 
      xhrFields: { 
       withCredentials: true 
      }, 
      beforeSend: function(xhr) { 
       xhr.setRequestHeader("Authorization", "Basic " + Base64.encode(username + ":" + password)); 
      }, 
      success: post_succes, 
      error: function(xhr, status, errThrown) { 
       var out = "<br>Error status " + status; 
       out += "<br>Error request status text: " + xhr.statusText; 
       out += "<br>Error request status: " + xhr.status; 
       out += "<br>Error request response text: " + xhr.responseText; 
       out += "<br>Error response header: " + xhr.getAllResponseHeaders(); 
       navigator.notification.alert(out); 
      } 
     }); 

我也試着設置在java主此值:(我知道這是不是正確的屬性...但絕望認定它出...)

super.setIntegerProperty("loadUrlTimeoutValue", 25000); 

它一直堅持到10秒....