Javascript PhoneGap构建iOS应用在启动屏幕后有一个空白的白色屏幕 我正在使用PooGePad构建3,试图清除溅泼屏幕后出现的空白白色屏幕。

Javascript PhoneGap构建iOS应用在启动屏幕后有一个空白的白色屏幕 我正在使用PooGePad构建3,试图清除溅泼屏幕后出现的空白白色屏幕。,javascript,ios,phonegap-build,Javascript,Ios,Phonegap Build,我做过研究,我能找到的只是对PhoneGap和Cordova的引用,而不是PhoneGap构建。我尝试过的所有方法都不起作用——主要是禁用自动启动屏幕隐藏,并使用JavaScript自动隐藏: 在config.xml中: <feature name="SplashScreen"> <param name="ios-package" value="CDVSplashScreen" /> <param name="onload" value="true"

我做过研究,我能找到的只是对PhoneGap和Cordova的引用,而不是PhoneGap构建。我尝试过的所有方法都不起作用——主要是禁用自动启动屏幕隐藏,并使用JavaScript自动隐藏:

在config.xml中:

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

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

window.location.href=mysite.com
文件。添加的监听器(“deviceready”,OnDeviceraddy,false);
函数ondevicerady(){
setTimeout(函数(){
navigator.splashscreen.hide();
}, 6000);
};

但这似乎忽略了我,并自动隐藏屏幕。我想这是因为此解决方案不适用于PhoneGap构建,但我不确定如何解决此问题。

完全感受到您的痛苦。PhoneGap构建的文档需要大量工作。 这几天我自己也一直在和这件事斗争。经过多次尝试和错误,这对我来说是有效的

在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" />

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

我想补充一点,我也有类似的问题,在我的情况下,这不是启动屏幕

在我使用PhoneGap build和Git的例子中,我向我的应用程序添加了一个javascript文件,但未能将新文件包含并推送到我的Git存储库。这导致我的应用程序在本地工作,但当构建服务器提取最新代码时,PhoneGap构建上显示白色屏幕


PhoneGap已初始化,但Kendo UI不喜欢缺少的引用js类,因此失败。这是一个PhoneGap noob错误,但我想与大家分享一下,以防它对有类似问题的人有所帮助,并且启动屏幕修复程序无法工作这可能是在加载移动ui框架之前发生的javascript错误。

如果您正在为应用程序使用白名单插件,则可能需要对config.xml进行如下更改才能使用phonegap构建

<gap:plugin name="cordova-plugin-whitelist" source="npm" version="~1" />

这是my config.xml中的cli规范

<preference name="phonegap-version" value="cli-5.2.0" />

尝试在配置和html上设置背景色。蓝色示例:

<preference name="SplashMaintainAspectRatio" value="false" />
<preference name="SplashScreenDelay" value="1" />
<preference name="backgroundColor" value="0xff0000ff" />

在html标签上

<html style="background-color:#0000ff;>
以下是步骤

1) 在config.xml中添加启动屏幕首选项

<preference
    name="SplashScreen"
    value="screen" />
<preference
    name="AutoHideSplashScreen"
    value="true" />
<preference
    name="SplashScreenDelay"
    value="5000" />

<feature name="SplashScreen" >
    <param
        name="android-package"
        value="org.apache.cordova.splashscreen.SplashScreen" />

    <param
        name="onload"
        value="true" />
</feature>
    <!-- you can use any density that exists in the Android project -->
    <splash
        density="land-hdpi"
        src="res/drawable-land-hdpi/splash.png" />
    <splash
        density="land-ldpi"
        src="res/drawable-land-ldpi/splash.png" />
    <splash
        density="land-mdpi"
        src="res/drawable-land-mdpi/splash.png" />
    <splash
        density="land-xhdpi"
        src="res/drawable-land-xhdpi/splash.png" />
    <splash
        density="port-hdpi"
        src="res/drawable-hdpi/splash.png" />
    <splash
        density="port-ldpi"
        src="res/drawable-ldpi/splash.png" />
    <splash
        density="port-mdpi"
        src="res/drawable-mdpi/splash.png" />
    <splash
        density="port-xhdpi"
        src="res/drawable-xhdpi/splash.png" />
</platform>

2) 在config.xml中声明初始屏幕

<preference
    name="SplashScreen"
    value="screen" />
<preference
    name="AutoHideSplashScreen"
    value="true" />
<preference
    name="SplashScreenDelay"
    value="5000" />

<feature name="SplashScreen" >
    <param
        name="android-package"
        value="org.apache.cordova.splashscreen.SplashScreen" />

    <param
        name="onload"
        value="true" />
</feature>
    <!-- you can use any density that exists in the Android project -->
    <splash
        density="land-hdpi"
        src="res/drawable-land-hdpi/splash.png" />
    <splash
        density="land-ldpi"
        src="res/drawable-land-ldpi/splash.png" />
    <splash
        density="land-mdpi"
        src="res/drawable-land-mdpi/splash.png" />
    <splash
        density="land-xhdpi"
        src="res/drawable-land-xhdpi/splash.png" />
    <splash
        density="port-hdpi"
        src="res/drawable-hdpi/splash.png" />
    <splash
        density="port-ldpi"
        src="res/drawable-ldpi/splash.png" />
    <splash
        density="port-mdpi"
        src="res/drawable-mdpi/splash.png" />
    <splash
        density="port-xhdpi"
        src="res/drawable-xhdpi/splash.png" />
</platform>


3) 最后在org.apache.cordova.splashscreen包下添加到您的android项目结构中


作为Cordova插件安装。

我只在iOS上遇到过类似的问题,就我而言,这与我在index.html上实现样式的方式有关。在我的例子中,我必须为不同的品牌提供款式,这取决于$scope变量。我在body中使用了@import,显然iOS有问题。我通过将CSS链接放回头部解决了这个问题。我使用$rootScopeng if触发基于品牌名称的正确样式。不知怎的,@import在启动屏幕后出现了空白的白色屏幕。。。我希望它能帮助任何有同样问题的人。

我也有同样的问题“启动屏幕后出现空白的白色屏幕”。出于某种原因,我在emulator iOS调试日志中收到以下消息:

deviceready has not fired after 5 seconds
已解决从my index.html中删除此元标记的问题

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

现在它可以在iOS上运行(没有在android上测试过)


这也是cordova插件splashscreen的文档。(搜索“iOS怪癖:”)

这就是答案。我错过了比赛,我也没意识到。我的头撞了几十次墙才露出来。@Bart我不能让这个在我的项目中起作用。在config.xml上已经有了相同的设置,我甚至尝试强制显示splashscreen(deviceready事件上的navigator.splashscreen.show()),但它仍然显示愚蠢的白色屏幕:(@Bart顺便说一句,我注意到这只发生在iPhone 3.5上),它在4“上工作正常。”…Dafuqa是一个旁注,刚刚在android 4.4设备上尝试并测试了这个功能,如果你只是为android开发,你不需要插件链接或代码,没有自动隐藏功能,因为
SplashScreenDelay
会自动隐藏启动屏幕。谢谢!这个评论帮助我理解我的错误可能在javascript中D不在XML或iOS代码中!非常感谢!这也帮助我调试它。我的问题是我使用棘齿库作为UI的基础,它自动设置了正文和内容CSS样式,BG颜色恰好是白色的。当我把它改为黑色时,问题就消失了。