android - Phonegap Build ios 6 iphone 5 启动画面不会消失

标签 android jquery ios cordova phonegap-build

嘿,我已经创建了一个 android/iphone 应用程序,它在 android 上运行得很好,但由于某种原因,它只显示启动屏幕/加载动画,而不是超越它。

屏幕如下:

enter image description here

在我的 config.xml 文件中,我有:

<!--App settings -->
    <preference name="phonegap-version"                                     value="2.3.0" />
    <preference name="orientation"                                          value="portrait" />
    <preference name="fullscreen"                                           value="true" />
    <preference name="exit-on-suspend"                                      value="true" />
    <preference name="auto-hide-splash-screen"                              value="false" />
    <preference name="splash-screen-duration"                               value="10000" />
    <preference name="webviewbounce"                                        value="true" />

在我的 javascript 中我有:

    //Wait for device
    function onDeviceReady() {
        navigator.splashscreen.hide();
    }

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

但是,我将此代码用于 index.html 文件:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=310;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title></title>
</head>

<body>
<script>
    window.location='https://fb.zzzzzzz.com/xxxxxx/index.php';
</script>
</body>
</html>

我缺少什么设置?难道是因为我在 .html 之后调用了 .php 页面?

最佳答案

在设备就绪事件被触发并处理后,它对我有用。

JavaScript

var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicity call 'app.receivedEvent(...);'
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);
        window.location='https://fb.zzzzzzz.com/xxxxxx/index.php';
    }
};

HTML

<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
    app.initialize();
</script>

关于android - Phonegap Build ios 6 iphone 5 启动画面不会消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15326556/

相关文章:

android studio,播放自定义铃声崩溃?

java - Firebase实时数据库: How to use onDisconnect

iOS:Grand Central Dispatch 和 ViewController

ios - 将自定义 (Retina) 图像添加到 UIBarButtonItem

ios - 我应该在新的Xcode项目中使用自动布局吗?

android - Android 上的密度

java - 如何旋转 opengl 3d 对象以指向 GPS 位置(纬度、经度)?

javascript - 我是 ajax 和 jquery 的新手,我需要一些关于如何将变量从 PHP 传递到 AJAX 的建议

jquery - 如何在 jQuery 中单击公共(public)类打开相同的模式

javascript - 如何循环访问这个 JSON 对象?