2011-12-16 62 views
1

我正在開發一個使用Rhomobile框架/ Rhodes(Ruby和JqueryMobile的組合)的移動應用程序。在手機上測試RhoMobile應用程序時出現'Error Loading Page'錯誤 - 使用jQuery Mobile

當我在模擬器的桌面上構建並測試我的應用程序時,單擊鏈接加載相關頁面。但是,當我嘗試訪問我的移動設備上的相同鏈接時,我收到一條消息,指出'錯誤加載頁面'。

如果任何人有任何使用jquerymobile/ruby​​/rhomobile的經驗,並知道爲什麼模擬器和移動設備之間存在不一致,請告訴我。我在下面列出了其他信息,如果還有其他信息,請告訴我。

有2個相關頁面。索引頁面加載超鏈接項目列表。每當單擊一個項目時會調用第二個頁面,並根據哪個項目被點擊來加載內容。這裏是我的索引頁代碼:

<script type="text/javascript"> 
$(document).ready(function() { 
    var fploadcounter =0; 
fpLoadIncidents(fploadcounter); 
    $('#fpitems').listview('refresh'); 
}); 
    function fpLoadIncidents(start, buttonname){ 
    $('.fpitem').remove(); 
    $('#fpnothing').hide(); 
    $('.fpitemdetailcontainer').remove(); 
    $('#itemsloading').show(); 

    var fpurl='data.json'; 
     $.ajax({ 
      dataType:"json", 
      url: fpurl, 
      async:false, 
      error: function(x,e,y) { 

      alert("There is an issue with the incident application. You can provide the following information to the admin: "+e+" "+x+" "+y+" "+x.status()); 
    }, 
     success: function(data){ 
      if (data.d==''){ 
$('#itemsloading').hide(); 
    $('#fpnothing').show(); 
      }else { 
       fphtmlstring=''; 
       fpdetailstring=''; 
       $.each(data.d, function(event) { 
         var fpdate1=this.EVENT_OCCURRED_2.substr(6,2); 
         var fpdate2=this.EVENT_OCCURRED_2.substr(4,2); 
         var fpdate3=this.EVENT_OCCURRED_2.substr(0,4); 
         var fpoccurreddate=fpdate1+'/'+fpdate2+'/'+fpdate3; 
         if ((this.RISK_RANKING=='N/A')||(this.RISK_RANKING==null)) { 
          var fprisk='-'; 
         } else { 
          var fprisk=this.RISK_RANKING; 
         } 

         if (this.HIGHEST_SEVERITY==null) { 
          var fpseverity='-'; 
         }else { 
          var fpseverity = this.HIGHEST_SEVERITY; 
         } 

        fphtmlstring=fphtmlstring+'<li>'; 
        fphtmlstring= fphtmlstring+ '<a class="itemlink" href="itemcontent.erb" filter="'+this.EVENT_+'">'; 
        fphtmlstring= fphtmlstring+ '<div class=" ui-li-count">'+fprisk+'</div>'; 
        fphtmlstring= fphtmlstring+ '<h3>'+this.EVENT_TYPE_NAME+'</h3>'; 
        fphtmlstring= fphtmlstring+ '<p>'+fpseverity+'</p>'; 
        fphtmlstring= fphtmlstring+ '<p class="ui-li-aside myaside">'+fpoccurreddate+'<br />'+this.STATUS_NAME+'</p></a></li>'; 
        $('#itemsloading').hide(); 
       }); 
         $('#fpitems').append(fphtmlstring); 
     }//the end of the if function 
    }, 
    complete: function() { 
     $('.itemlink').click(function() { 
     itemid=$(this).attr('filter'); 
     }); 
     $('#fpitems').listview('refresh'); 
    } 
          }); 
} 
</script> 
<style> 
.myaside { 
width: 30%; 

} 
.hidden { 
display:none; 
} 
.ui-li-static{ 
    background-color: white; 

} 
</style> 

<div data-role="page" id="incidents" data-url="<%= Rho::RhoConfig.start_path %>/" > 

<div data-role="header" data-position="inline" data-theme="b"> 
<h1>Latest Incidents</h1> 
<%= link_to "Settings", :controller => :Settings %> 
<%= link_to "Logout", :controller => :Settings, :action => :logout %> 
</div> 

<div data-role="content"> 
<ul id="fpitems" data-role="listview" data-theme="d" data-count-theme="b"> 
</ul> 
</div> 
</div> 

這裏是我的內容頁面代碼:

<div data-role="page" id="incidentdetails" data-url="<%= Rho::RhoConfig.start_path %>/" data-add-back-btn="true" data-theme="b" data-content-theme="b"> 
<script type="text/javascript"> 

$(document).delegate("#incidentdetails", "pagebeforecreate", function() { 

fpLoadIncidentdetail(); 

}); 

function fpLoadIncidentdetail(){ 
$('#incidentdetails').html(''); 
    var fpurl='data.json'; 

      $.ajax({ 
       dataType:"json", 
       url: fpurl, 
       async:false, 
       error: function(x,e,y) { 

       alert("There is an issue with the incident application. You can provide the following information to the admin: "+e+" "+x+" "+y+" "+x.status()); 

     }, 
      success: function(data){ 
        if (data.d==''){ 
     $('#itemsloading').hide(); 
     $('#fpnothing').show(); 


        }else { 
        fphtmlstring=''; 
        fpdetailstring=''; 
         $.each(data.d, function(event) { 


      if (itemid==this.EVENT_){ 

          var fpdate1=this.EVENT_OCCURRED_2.substr(6,2); 
          var fpdate2=this.EVENT_OCCURRED_2.substr(4,2); 
          var fpdate3=this.EVENT_OCCURRED_2.substr(0,4); 
          var fpoccurreddate=fpdate1+'/'+fpdate2+'/'+fpdate3; 

          if ((this.RISK_RANKING=='N/A')||(this.RISK_RANKING==null))  { 
           var fprisk='-'; 
          } else { 
            var fprisk=this.RISK_RANKING; 
          } 

          if (this.HIGHEST_SEVERITY==null) { 
            var fpseverity='-'; 
          }else { 
            var fpseverity = this.HIGHEST_SEVERITY; 
           } 

         fpdetailstring=fpdetailstring+'<div data-role="header" data-position="inline" data-theme="b">'; 
         fpdetailstring=fpdetailstring+'<h1 id="incident-title">Incident: '+this.EVENT_TYPE_NAME+'</h1>'; 
         fpdetailstring=fpdetailstring+'</div> <div data-role="content" id="fpitemdetailscroll">'; 
         fpdetailstring=fpdetailstring+'<div class="fpitemdetailcontainer" id="'+this.EVENT_+'">'; 
         fpdetailstring=fpdetailstring+'<h2>'+this.EVENT_TYPE_NAME+'</h2>'; 
         fpdetailstring=fpdetailstring+'<div data-content-theme="d"><h3>Details</h3>'; 
         fpdetailstring=fpdetailstring+'<ul data-role="listview" class="incident-details" data-theme="d">'; 
         fpdetailstring=fpdetailstring+'<li>Occurred: '+fpoccurreddate+'</li>'; 
         fpdetailstring=fpdetailstring+'<li>Location: '+this.LOCATION_NAME+'</li>'; 
         fpdetailstring=fpdetailstring+'<li>Business Unit: '+this.BUSINESS_UNIT_NAME+'</li>'; 
         fpdetailstring=fpdetailstring+'<li>Risk Ranking: '+this.RISK_RANKING+'</li>'; 
         fpdetailstring=fpdetailstring+'<li>Highest Severity: '+fpseverity+'</li></ul></div>'; 
         fpdetailstring=fpdetailstring+'<div><h3>Description</h3> '+this.BRIEF_DESCRIPTION_2+'</div>'; 
         fpdetailstring=fpdetailstring+'<div><h3>Immediate Actions Taken</h3> '+this.IMMEDIATE_ACTIONS_TAKEN+'</div></div></div>'; 
            } 
        }); 

        $('#incidentdetails').append(fpdetailstring); 
             }//the end of the iff function 
     } 
           }); 
      } 
    </script> 
       </div> 

回答

0

日誌通常做的,告訴你什麼是錯的一個好工作。

檢查應用程序日誌 - 在Android上單擊Settings > Log

啓用調試功能後,請將設備插入計算機,然後將設備插入計算機中並run logging through adb

此外,請確保在Rhodes應用程序中設置了足夠詳細的日誌記錄。打開rhoconfig.txt並確保MinSeverity = 1(至少或0)。

相關問題