我使用Phonegap超过一年,直到现在我的Splashscreen都没问题。我决定从3.7.0迁移到cli-5.2.0(我认为即使它是cli-5.1.1也没有区别)我无法使我的SplashScreen工作。
我已经阅读了here,在cli-5.1.1及更高版本中你需要来自npm的新的splashscreen插件才能使它工作(直到现在我所要做的就是指定闪屏图像的路径)。
所以我的配置文件最终是这样的:
<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/Default@2x.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="res/screen/ios/Default-568h@2x.png" 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/Default-Landscape@2x.png" 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/Default-Portrait@2x.png" 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秒(启动画面应该出现的时间),然后我的应用程序从第一个屏幕正常启动
的编辑:
完整配置文件如下
<?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/icon-60@2x.png" 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/icon-76@2x.png" 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/icon-40@2x.png" 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/icon@2x.png" 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/icon-72@2x.png" 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/icon-small@2x.png" 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/icon-50@2x.png" 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/Default@2x.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="res/screen/ios/Default-568h@2x.png" 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/Default-Landscape@2x.png" 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/Default-Portrait@2x.png" 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>
已编辑2:
今天我在IOS上测试了它。启动画面显示但应用程序卡在那里。它不会在5秒后禁用启动画面
我无法弄清楚发生了什么。我将回到3.7.0直到它被解决。
答案 0 :(得分:0)
我遇到了同样的问题,但我知道您可以轻松修复iOS卡片:
在您的主html文件中:
document.addEventListener("resume", onResume, false);
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
//Hide Splashscreen
navigator.splashscreen.hide();
我知道你提到你不使用j来显示/隐藏启动画面,但是对于iOS你被迫:((至少根据我的经验)