简体   繁体   English

直到轻按即可启动Cordova iOS设备

[英]cordova ios device ready not fire until tap

I use cordova regular on ubuntu for android. 我在ubuntu上为Android使用Cordova Regular。

I compile with build.phonegap.com for ios, uploading zip project. 我使用build.phonegap.com进行ios编译,上传zip项目。

with Android all fine, but with ios deviceready not fire until i tap or change the focus to other thing. 使用Android一切都很好,但是使用ios deviceready时不会触发,直到我点击或将焦点更改为其他东西。

Mi index is simple: Mi索引很简单:

  <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 和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? 您是否尝试过重启?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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