启动屏幕后,PhoneGap Build iOS应用程序有空白屏幕 [英] PhoneGap Build iOS app has blank white screen after splash screen

查看:95
本文介绍了启动屏幕后,PhoneGap Build iOS应用程序有空白屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PhoneGap Build 3.0,试图摆脱启动画面后出现的空白屏幕。

I'm using PhoneGap Build 3.0, attempting to get rid of the blank white screen that appears after the splash screen.

我已经完成了研究而且所有我可以找到对PhoneGap和Cordova的引用,而不是PhoneGap Build。我尝试过的东西都没有用 - 主要是禁用自动闪屏隐藏,并用JavaScript自动隐藏它:

I've done research and all I can find is references to PhoneGap and Cordova, not PhoneGap Build. None of the things I've tried have worked--mainly, disabling the auto splash screen hide, and hiding it automatically with JavaScript:

在config.xml中:

In the config.xml:

<feature name="SplashScreen">
    <param name="ios-package" value="CDVSplashScreen" />
    <param name="onload" value="true" />
</feature>

在index.html中:

In index.html:

<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">
        window.location.href = mysite.com

        document.AddEventListener("deviceready", OnDeviceReady, false);

        function OnDeviceReady() {
            setTimeout(function() { 
                navigator.splashscreen.hide();
            }, 6000);
        };
    </script>

但这似乎会忽略我并自动隐藏屏幕。我认为这是因为这个解决方案不适用于PhoneGap Build,但我不确定如何修复此问题。

But this appears to ignore me and auto-hide the screen regardless. I assume this is because this solution is not for PhoneGap Build, but I'm not sure how else to go about fixing this.

推荐答案

完全感受到你的痛苦。 PhoneGap Build的文档需要大量工作。
我自己过去几天一直在和这个人打架。经过多次试验和错误后,这对我有用。

Totally feel your pain on this. The docs for PhoneGap Build need a lot of work. I've been fighting with this the last couple of days myself. After much trial and error, this is what has worked for me.

在config.xml中:

<!-- Do not auto hide splash on iOS -->
<preference name="AutoHideSplashScreen" value="false" />
<!-- Do not auto hide splash on Android -->
<preference name="SplashScreenDelay" value="10000"/>

<gap:plugin name="org.apache.cordova.splashscreen" />

Android似乎没有AutoHide参数,所以我们只是给它一个很长的延迟。在达到这10秒之前,我们将使用JS手动隐藏它。

Android does not seem to have an AutoHide param, so we just give it a long delay. We will hide it manually with JS before this 10 seconds is reached.

javascript代码需要在config.xml中添加插件引用navigator.splashscreen.hide(); 工作。

Adding the plugin reference in the config.xml is needed for the javascript code navigator.splashscreen.hide(); to work.

此外,我发现我的项目(使用Kendo UI Mobile)没有setTimeout延迟在 onDeviceReady 中需要。我猜,一旦你在config.xml中得到了正确的参数,你就会在你的应用中看到相同的。

Also, I found for my project (using Kendo UI Mobile) that no setTimeout delay was needed within onDeviceReady. I am guessing, that once you get the correct params within your config.xml, you will see the same in your app.

我的 onDeviceReady 看起来像这样:

document.addEventListener('deviceready', function() {
  navigator.splashscreen.hide();
});

使用PhoneGap Build 3.1在iOS 6和Android 4.1上测试。

Tested on iOS 6, and Android 4.1 using PhoneGap Build 3.1.

这篇关于启动屏幕后,PhoneGap Build iOS应用程序有空白屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆