PhoneGap构buildiOS应用程序在启动屏幕后具有空白的白色屏幕

我正在使用PhoneGap Build 3.0,试图摆脱闪屏之后出现的空白屏幕。

我已经做了研究,所有我能find的是对PhoneGap和Cordova的引用,而不是PhoneGap Build。 我尝试过的东西都没有工作 – 主要是禁用自动启动屏幕隐藏,并使用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> 

但是这似乎忽略了我自动隐藏屏幕不pipe。 我认为这是因为这个解决scheme不适用于PhoneGap Build,但我不知道如何解决这个问题。

完全感觉到你的痛苦。 PhoneGap Build的文档需要很多工作。 我自己在过去的几天里一直在和这个战斗。 经过多次的反复试验,这就是为我工作的。

在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手动隐藏它。

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

另外,我发现我的项目(使用Kendo UI Mobile)在onDeviceReady中不需要setTimeout延迟。 我猜测,一旦你在你的config.xml中得到了正确的参数,你将在你的应用程序中看到相同的参数。

我的onDeviceReady看起来像这样:

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

使用PhoneGap Build 3.1testingiOS 6和Android 4.1。

我想补充说,我有一个类似的问题,在我的情况下,它不是启animation面。

在我的情况下,使用PhoneGap构build和Git,我添加了一个JavaScript文件到我的应用程序,但未能包括并推送新的文件到我的git存储库。 这导致我的应用程序在本地工作,但是当构build服务器拉取最新的代码时,它显示PhoneGap构build上的白色屏幕。

PhoneGap已初始化,但Kendo UI不喜欢缺less引用的js类并失败。 这是一个PhoneGap noob错误,但我想共享只是incase它可以帮助有类似的问题,并启animation面修复不起作用的人。 这可能是一个JavaScript错误发生之前,你的移动UI框架加载。

如果您的应用程序使用的是白名单插件,则可能需要在config.xml中进行更改,如下所述,以使用phonegap构build。

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

这是我的config.xml中的cli规范。

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

尝试设置背景颜色,在configuration和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> 

2)在config.xml中声明你的启animation面

  <!-- 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上实现样式的方式有关。 在我的情况下,我不得不为不同的品牌提供样式,它依赖于$ scopevariables。 我在内部使用@import ,显然iOS有问题。 我通过把CSS链接放回头来解决了这个问题。 我使用$ rootScopeng-if来根据品牌名称触发正确的样式。 不知何故,它是与@import的结果与闪屏后空白的白色屏幕…我希望它可以帮助任何人有同样的问题。

我有同样的问题“闪屏后空白的白屏”。 由于某种原因,我在仿真器iOSdebugging日志中收到了这条消息:

 deviceready has not fired after 5 seconds 

已经解决了从我的index.html中删除这个元标记

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

现在它在iOS中工作(没有在Androidtesting)。 参考#1在这里!

这也是cordova-plugin-splashscreen的文档。 (search“iOS Quirk:”)。 参考#2在这里!