7

Cordova(=Phonegap) と Ember.js および jQuery Mobile の統合に苦労しています。Ember.js + jQuery Mobile は問題なく動作します。任意のデスクトップ ブラウザーで index.html を読み込むと、アプリが正常に読み込まれます。

xCode 4 と iPhone 5.1 シミュレーターを使用すると、ハンドルバー タグ内にコンテンツが表示されません。つまり、Ember.js の読み込みに失敗します。

index.html:

<html lang="en"> 
<head>

  <title></title>

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
  <meta charset="utf-8">

  <link rel="apple-touch-icon" href="/apple-touch-icon.png">

  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />

</head>
<body>
  <script type="text/x-handlebars" data-template-name="main">
    this text is NOT displayed

  </script>

  <div> this text IS displayed </div>


  <script src="js/vendor/jquery.min.js"></script>
  <script src="js/vendor/jquery.mobile.js"></script>
  <script src="js/vendor/ember.js"></script>
  <script src="js/app/app.js"></script>
  <script src="js/vendor/cordova-1.5.0.js"></script>
  <script type="text/javascript">

      // If you want to prevent dragging, uncomment this section
      function preventBehavior(e){ 
          e.preventDefault(); 
      };
      document.addEventListener("touchmove", preventBehavior, false);


      document.addEventListener("deviceready", onDeviceReady, false);

      /* When this function is called, Cordova has been initialized and is ready to roll */
      /* If you are supporting your own protocol, the var invokeString will contain any arguments to the app launch.
      see http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
      for more details -jm */
      function onDeviceReady(){
          // do your thing!
      }

  </script>

</body>
</html>
4

1 に答える 1

3

問題が見つかりました。XCodeは次のように報告していました:

 ERROR whitelist rejection: url='http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css'

これに続いて、。内の配列に追加*.jquery.comしました。ExternalHostsCordova.plist

于 2012-04-06T17:58:25.040 に答える