简体   繁体   中英

cordova ios device ready not fire until tap

I use cordova regular on ubuntu for android.

I compile with build.phonegap.com for ios, uploading zip project.

with Android all fine, but with ios deviceready not fire until i tap or change the focus to other thing.

Mi index is simple:

  <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>

and the index.js

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


function onDeviceReady() {....stuff}

i try diferent alternatives to content-policy and diferent ways to atach event

What is the correct way?

finally removing all platforms and plugins, and adding them after, solve my problems.

have you tried restarting?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM