2017-09-21 85 views
0

我在android上使用cordova常規在ubuntu上。科爾多瓦ios設備準備不會觸發,直到水龍頭

我使用build.phonegap.com爲ios編譯,上傳zip項目。

與Android都很好,但與ios deviceready不會觸發,直到我點擊或改變焦點到其他事情。

冪指數很簡單:

<head> 
     <!-- 
     Customize this policy to fit your own app's needs. For more guidance, see: 
      https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy 
     Some notes: 
      * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication 
      * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly 
      * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this: 
       * Enable inline JS: add 'unsafe-inline' to default-src 
     --> 
     <meta http-equiv="Content-Security-Policy" 
     content=" 
     default-src 'self' https://ssl.gstatic.com data:* gap://* file://* tel:* 'unsafe-inline' 'unsafe-eval' ; 
     style-src 'self' 'unsafe-inline'; 
     frame-src 'self' s-static.ak.facebook.com static.ak.facebook.com www.facebook.com; 
     connect-src 'self' https://app.mypage.es/ connect.facebook.net www.facebook.com; 
     media-src *; 
     img-src 'self' www.google-analytics.com www.facebook.com; 
     script-src 'self' 'unsafe-inline' www.google-analytics.com connect.facebook.net www.facebook.com"> 
     <meta name="format-detection" content="telephone=no"> 
     <meta name="msapplication-tap-highlight" content="no"> 
     <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> 
     <link rel="stylesheet" type="text/css" href="css/index.css"> 
     <title>Hello World</title> 
    </head> 
    <body> 
     <div class="app"> 

     </div> 

     <script type="text/javascript" src="jquery-3.2.1.min.js"></script> 
     <script src="fastclick.js"></script> 
     <script type="text/javascript" src="cordova.js"></script> 
     <script type="text/javascript" src="js/index.js"></script>   
    </body> 
</html> 

和index.js

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


function onDeviceReady() {....stuff} 

我嘗試atach事件

diferent替代內容的策略和diferent方式什麼是正確的辦法?

+0

我用weinre實現調試,發現: 5秒鐘後deviceready沒有被觸發。 頻道未被觸發:onCordovaConnectionReady 頻道未被觸發:onCordovaInfoReady –

回答

0

終於刪除所有平臺和插件,並添加它們之後,解決我的問題。

你試過重新啓動嗎?

相關問題