2012-04-06 22 views
7

Tôi đang đấu tranh để tích hợp Cordova (= Phonegap) với Ember.js và jQuery Mobile. Ember.js + jQuery Mobile hoạt động tốt, khi tải index.html trong bất kỳ trình duyệt máy tính để bàn nào tải thành công ứng dụng.Có ai đã tích hợp thành công Ember.js - Phonegap (và jQuery Mobile) không?

Sử dụng xCode 4 và trình mô phỏng iPhone 5.1, nó không hiển thị bất kỳ nội dung nào trong thẻ tay lái. Điều này có nghĩa là Ember.js không tải được.

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> 

Trả lời

3

Tìm thấy vấn đề. XCode được báo cáo:

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

Sau this, tôi đã thêm *.jquery.com đến các mảng ExternalHosts, trong Cordova.plist.

+1

Tôi sẽ cho bạn biết, ứng dụng của bạn sẽ bị từ chối nếu bạn đang đặt phụ thuộc jQuery của bạn vào kết nối mạng. Bạn có thể sử dụng mạng nhưng bạn cần phải có mọi thứ để cho phép người dùng biết lý do tại sao một phần của ứng dụng không hoạt động vì họ không có kết nối. –

+0

sửa chữa css - cùng một điều mặc dù. ứng dụng của bạn cần phải có các loại tệp đó được tải để được chấp thuận. –

+0

Cảm ơn lời khuyên. Không biết điều đó, tôi đã có ý định làm cho ứng dụng hoàn toàn khả dụng ngoại tuyến. –

Các vấn đề liên quan