本文介绍了Splashscreen无法在Phonegap Build cli-5.2.0上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Phonegap已有一年多了,直到现在我的Splashscreen都没有问题.我决定从3.7.0升级到cli-5.2.0(即使是cli-5.1.1,我认为也没有什么不同),而且我无法使SplashScreen正常工作.
我已阅读 此处 在cli-5.1.1及更高版本中,您需要使用npm中的新启动画面插件才能使其正常运行(直到现在,我要做的就是指定启动画面图像的路径).
因此,我的配置文件最终如下所示:

I use Phonegap for over a year and I had no problem with my Splashscreen until now. I decided to move from 3.7.0 to cli-5.2.0 (I think it would make no difference even if it was cli-5.1.1) and I cannot make my SplashScreen work.
I have read here that in cli-5.1.1 and above you need the new splashscreen plugin from npm in order to make it work (until now all I had to do was to specify the paths of splashscreen images).
So my config file ended up in something like this:

    <gap:splash gap:qualifier="port-ldpi" gap:platform="android" src="res/screen/android/splash-port-ldpi.png" width="320" height="426" />
    <gap:splash gap:qualifier="port-mdpi" gap:platform="android" src="res/screen/android/splash-port-mdpi.png" width="320" height="470" />
    <gap:splash gap:qualifier="port-hdpi" gap:platform="android" src="res/screen/android/splash-port-hdpi.png" width="480" height="640" />
    <gap:splash gap:qualifier="port-xhdpi" gap:platform="android" src="res/screen/android/splash-port-xdpi.png" width="720" height="960" />

.....

    <gap:splash src="res/screen/ios/Default.png" gap:platform="ios" width="320" height="480" />
    <gap:splash src="res/screen/ios/[email protected]" gap:platform="ios" width="640" height="960" />
    <gap:splash src="res/screen/ios/[email protected]" gap:platform="ios" width="640" height="1136" />
    <gap:splash src="res/screen/ios/Default-Landscape.png" gap:platform="ios" width="1024" height="748" />
    <gap:splash src="res/screen/ios/[email protected]" gap:platform="ios" width="2048" height="1496" />
    <gap:splash src="res/screen/ios/Default-Portrait.png" gap:platform="ios" width="768" height="1004" />
    <gap:splash src="res/screen/ios/[email protected]" gap:platform="ios" width="1536" height="2008" />

    <!-- splashscreen delay -->
    <preference name="SplashScreenDelay" value="5000" />
    <preference name="ShowSplashScreen" value="true" />
    <preference name="AutoHideSplashScreen" value="false" />    
    <preference name="FadeSplashScreen" value="false"/>


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

.....

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

    <gap:plugin name="cordova-plugin-splashscreen" source="npm" />


我尝试了太多的版本,甚至忘了它们.谁能看到问题出在哪里,或者必须提出其他建议?

我想指定我不使用任何默认的SplashScreen图像(我尝试设置一个,但是我没有运气.除了3.7.0之前它没有用,所以为什么要现在使用),并且我不使用任何一种javascript以显示/隐藏启动画面.
当我的应用程序启动时,它会显示黑屏约5秒钟(应显示启动屏幕的时间),然后我的应用程序通常会从第一个屏幕启动


已编辑:
完整的配置文件如下


I tried too many versions that I cannot even remember them. Can anyone see where the problem is, or has to suggest anything else?

I want to specify that I do not use any default SplashScreen image (I tried to set one, but I had no luck. Besides until 3.7.0 it had no use, so why to have now) and I do not use any kind of javascript to show/hide the splashscreen.
When my app starts, it shows a black screen for about 5sec(the time the splashscreen should appear) and then my app starts normally from the first screen


EDITED:
The full config file is the following

<?xml version="1.0" encoding="UTF-8"?>

<widget xmlns     = "hxxp://www.w3.org/ns/widgets"
        xmlns:gap = "hxxp://phonegap.com/ns/1.0"
        id        = "..."
        versionCode   = "100"
        version   = "1.0.0">
    <name>...</name>

    <description>...</description>

    <author href="..." email="...">...</author>

    <gap:config-file platform="ios" parent="CFBundleShortVersionString">
        <string>1.0.0</string>
    </gap:config-file>


    <!-- ANDROID ICONS -->
    <icon density="mdpi" gap:platform="android" src="res/android/icon-48-mdpi.png" width="48" height="48" />
    <icon density="hdpi" gap:platform="android" src="res/android/icon-72-hdpi.png" width="72" height="72" />
    <icon density="xhdpi" gap:platform="android" src="res/android/icon-96-xhdpi.png" width="96" height="96" />
    <icon density="xxhdpi" gap:platform="android" src="res/android/icon-144-xxhdpi.png" width="144" height="144" />

    <gap:splash gap:qualifier="port-ldpi" gap:platform="android" src="res/screen/android/splash-port-ldpi.png" width="320" height="426" />
    <gap:splash gap:qualifier="port-mdpi" gap:platform="android" src="res/screen/android/splash-port-mdpi.png" width="320" height="470" />
    <gap:splash gap:qualifier="port-hdpi" gap:platform="android" src="res/screen/android/splash-port-hdpi.png" width="480" height="640" />
    <gap:splash gap:qualifier="port-xhdpi" gap:platform="android" src="res/screen/android/splash-port-xdpi.png" width="720" height="960" />



    <!-- IOS ICONS -->
    <!-- iOS 7.0+ -->
    <!-- iPhone / iPod Touch  -->
    <icon src="res/ios/icon-60.png" gap:platform="ios" width="60" height="60" />
    <icon src="res/ios/[email protected]" gap:platform="ios" width="120" height="120" />
    <!-- iPad -->
    <icon src="res/ios/icon-76.png" gap:platform="ios" width="76" height="76" />
    <icon src="res/ios/[email protected]" gap:platform="ios" width="152" height="152" />
    <!-- iOS 6.1 -->
    <!-- Spotlight Icon -->
    <icon src="res/ios/icon-40.png" gap:platform="ios" width="40" height="40" />
    <icon src="res/ios/[email protected]" gap:platform="ios" width="80" height="80" />
    <!-- iPhone / iPod Touch -->
    <icon src="res/ios/icon.png" gap:platform="ios" width="57" height="57" />
    <icon src="res/ios/[email protected]" gap:platform="ios" width="114" height="114" />
    <!-- iPad -->
    <icon src="res/ios/icon-72.png" gap:platform="ios" width="72" height="72" />
    <icon src="res/ios/[email protected]" gap:platform="ios" width="144" height="144" />
    <!-- iPhone Spotlight and Settings Icon -->
    <icon src="res/ios/icon-small.png" gap:platform="ios" width="29" height="29" />
    <icon src="res/ios/[email protected]" gap:platform="ios" width="58" height="58" />
    <!-- iPad Spotlight and Settings Icon -->
    <icon src="res/ios/icon-50.png" gap:platform="ios" width="50" height="50" />
    <icon src="res/ios/[email protected]" gap:platform="ios" width="100" height="100" />

    <gap:splash src="res/screen/ios/Default.png" gap:platform="ios" width="320" height="480" />
    <gap:splash src="res/screen/ios/[email protected]" gap:platform="ios" width="640" height="960" />
    <gap:splash src="res/screen/ios/[email protected]" gap:platform="ios" width="640" height="1136" />
    <gap:splash src="res/screen/ios/Default-Landscape.png" gap:platform="ios" width="1024" height="748" />
    <gap:splash src="res/screen/ios/[email protected]" gap:platform="ios" width="2048" height="1496" />
    <gap:splash src="res/screen/ios/Default-Portrait.png" gap:platform="ios" width="768" height="1004" />
    <gap:splash src="res/screen/ios/[email protected]" gap:platform="ios" width="1536" height="2008" />

    <!-- splashscreen delay -->
    <preference name="SplashScreenDelay" value="5000" />
    <preference name="ShowSplashScreen" value="true" />
    <preference name="AutoHideSplashScreen" value="false" />    
    <preference name="FadeSplashScreen" value="false"/>


    <preference name="phonegap-version" value="cli-5.2.0" />
    <preference name="fullscreen" value="false" />
    <preference name="LoadUrlTimeoutValue" value="10000"/>
    <preference name="AllowInlineMediaPlayback" value="true"/>

    <preference name="KeepRunning" value="true"/>   


<access origin="*" />


    <feature name="App">
      <param name="android-package" value="org.apache.cordova.App"/>
    </feature>
    <feature name="Geolocation">
      <param name="android-package" value="org.apache.cordova.GeoBroker"/>
    </feature>
    <feature name="Device">
      <param name="android-package" value="org.apache.cordova.Device"/>
    </feature>
    <feature name="NetworkStatus">
      <param name="android-package" value="org.apache.cordova.NetworkManager"/>
    </feature>
    <feature name="Notification">
      <param name="android-package" value="org.apache.cordova.Notification"/>
    </feature>
    <feature name="SplashScreen">
      <param name="android-package" value="org.apache.cordova.SplashScreen"/>
    </feature>
    <feature name="SplashScreen">
        <param name="ios-package" value="CDVSplashScreen" />
    </feature>
    <feature name="InAppBrowser">
      <param name="android-package" value="org.apache.cordova.InAppBrowser"/>
    </feature>
    <feature name="InAppBrowser">
        <param name="ios-package" value="CDVInAppBrowser" />
    </feature>

    <gap:plugin name="cordova-plugin-splashscreen" source="npm" />
    <gap:plugin name="cordova-plugin-inappbrowser" source="npm" />
</widget>





今天,我在IOS上对其进行了测试.初始屏幕出现,但应用卡在那里.它不会像应做的那样在5秒后禁用启动屏幕.
我不知道发生了什么事.我将继续使用3.7.0直到解决.




EDITED 2:
Today I tested it on IOS. The splashscreen shows up but the app stucks there. It does not disables the splashscreen after 5sec as it should do.
I cannot figure out what is happening. I am going back on 3.7.0 until it is solved.

推荐答案

我遇到了同样的问题,但是我知道一个简单的解决方法可以解决iOS启动画面卡住的问题:

I'm having the same problem but I know an easy fix for your stuck iOS splashscreen:

在您的主要html文件中:

In your main html file:

document.addEventListener("resume", onResume, false);
document.addEventListener('deviceready', onDeviceReady, false);
    function onDeviceReady() {
        //Hide Splashscreen 
        navigator.splashscreen.hide();

我知道您提到您没有使用js显示/隐藏启动画面,但是对于iOS,您被迫:((至少以我的经验)

I know you mentioned you don't use js to show/hide the splashscreen, but for iOS you are forced to :( (at least in my experience)

这篇关于Splashscreen无法在Phonegap Build cli-5.2.0上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 10:09