1

我正在使用 Rhomobile 框架/Rhodes 开发一个移动应用程序 - Ruby 和 JqueryMobile 的组合。

当我在模拟器的桌面上构建和测试我的应用程序时,单击链接会加载相关页面。但是,当我尝试在移动设备上访问相同的链接时,我会收到一条消息,指出“加载页面错误”。

如果有人有任何使用 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>
4

1 回答 1

0

日志通常可以很好地告诉您出了什么问题。

检查应用程序日志 - 在 Android 上,单击Settings > Log

启用调试后,将设备插入计算机并通过 adb 运行日志记录

此外,确保在 Rhodes 应用程序中设置了足够详细的日志记录。打开rhoconfig.txt并确保MinSeverity = 1(至少,或 0)。

于 2011-12-21T14:25:05.403 回答