gpt4 book ai didi

cordova - 使用 Cordova/Phonegap 构建的应用程序启动后卡在黑屏上,安装后首次加载

转载 作者:行者123 更新时间:2023-12-05 03:12:19 28 4
gpt4 key购买 nike

我正在使用 Cordova/Phonegap 构建一个应用程序,并且还在其中使用了一个 chcp 插件。当我安装后第一次打开它时,应用程序在启动画面后卡在黑屏上。

当我关闭应用程序并再次启动时,它工作正常,但启动延迟了 9-10 秒,我将启动画面的时间延长到 10 秒以避免黑屏。

这是config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.storehippo.profitdeals" versionCode="103" version="1.0.3">
<name>Test</name>
<description>CHCP splash Test</description>
<author email="akshay.tiwari@mausis.com" href="http://cordova.io">Akshay Tiwari</author>
<content src="index.html"/>
<access origin="*"/>
<gap:config-file platform="ios" parent="CFBundleShortVersionString">
<string>103</string>

</gap:config-file>
<chcp>
<config-file url="http://s3.amazonaws.com/mystore.in/s/55d178025c64d45531612809/ms.mobile_app_themes/560bd8ec31fec3dd1dd66fb7/chcp.json"/>
</chcp>
<gap:platform name="android"/>
<gap:platform name="ios"/>
<preference name="permissions" value="none"/>
<preference name="orientation" value="default"/>
<preference name="android-windowSoftInputMode" value="adjustResize"/>
<preference name="fullscreen" value="false"/>
<preference name="webviewbounce" value="true"/>
<preference name="android-minSdkVersion" value="14"/>
<preference name="KeepRunning" value="false"/>
<preference name="LoadUrlTimeoutValue" value="10000"/>
<preference name="android-installLocation" value="auto"/>
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="SplashScreenDelay" value="10000"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="StatusBarOverlaysWebView" value="false"/>
<preference name="StatusBarBackgroundColor" value="#000000"/>
<preference name="StatusBarStyle" value="lightcontent"/>
<preference name="phonegap-version" value="3.7.0" />
<icon src="nocon.png"/>
<icon src="icons/ios/reader-57-1.png" gap:platform="ios" width="57" height="57"/>
<icon src="icons/ios/reader-72-1.png" gap:platform="ios" width="72" height="72"/>
<icon src="icons/ios/reader-76-1.png" gap:platform="ios" width="76" height="76"/>
<icon src="icons/ios/reader-114-1.png" gap:platform="ios" width="114" height="114"/>
<icon src="icons/ios/reader-120-1.png" gap:platform="ios" width="120" height="120"/>
<icon src="icons/ios/reader-144-1.png" gap:platform="ios" width="144" height="144"/>
<icon src="icons/ios/reader-152-1.png" gap:platform="ios" width="152" height="152"/>
<icon src="icons/android/ldpi.png" gap:platform="android" gap:density="ldpi"/>
<icon src="icons/android/mdpi.png" gap:platform="android" gap:density="mdpi"/>
<icon src="icons/android/hdpi.png" gap:platform="android" gap:density="hdpi"/>
<icon src="icons/android/xhdpi.png" gap:platform="android" gap:density="xhdpi"/>
<gap:splash src="splash.png"/>
<gap:splash src="splash/ios/Default.png" gap:platform="ios" width="1024" height="768"/>
<gap:splash src="splash/ios/Default-Portrait.png" gap:platform="ios" width="768" height="1024"/>
<gap:splash src="splash/ios/Default@2x.png" gap:platform="ios" width="2048" height="1536"/>
<gap:splash src="splash/ios/Default-Portrait@2x.png" gap:platform="ios" width="640" height="960"/>
<gap:splash src="splash/ios/Default-568h@2x.png" gap:platform="ios" width="640" height="1136"/>
<gap:splash src="splash/android/ldpi.png" gap:platform="android" gap:density="ldpi"/>
<gap:splash src="splash/android/mdpi.png" gap:platform="android" gap:density="mdpi"/>
<gap:plugin name="cordova-hot-code-push-plugin" source="npm" version="1.0.4"/>
<gap:plugin name="cordova-plugin-device" source="npm" version="1.1.0" />
<gap:plugin name="cordova-plugin-dialogs" source="npm" version="1.2.0" />
<gap:plugin name="cordova-plugin-inappbrowser" source="npm" version="1.1.0" />
<gap:plugin name="cordova-plugin-network-information" source="npm" version="1.1.0" />
<gap:plugin name="cordova-plugin-push-notification" source="npm" version="2.5.2" />
<gap:plugin name="cordova-plugin-splashscreen" source="npm" version="3.0.0" />
<gap:plugin name="cordova-plugin-statusbar" source="npm" version="2.0.0" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" version="1.0.0" />
<gap:plugin name="cordova-plugin-x-toast" source="npm" version="2.2.2" />
<gap:plugin name="cordova.plugins.diagnostic" source="npm" version="2.2.4" />
</widget>

最佳答案

当您说卡在黑屏上时,您的意思是它真的卡住了,您必须强行关闭应用程序,或者它只是显示黑屏,然后应用程序立即加载?

我在安装后的第一次加载时遇到问题,在启动画面后黑屏通常(可能总是)在第一次安装时显示一两秒钟,此后将按预期加载但它没有得到坚持适当的参数(只显示几秒钟提到的黑屏)。随后重新打开该应用程序不会出现此类问题(仅在初始安装时发生)...我仍在寻找解决该问题的方法,尽管它不是主要问题。

我看到您使用的版本是 <gap:plugin name="cordova-plugin-splashscreen" source="npm" version="3.0.0" />我在另一个问题上遇到了新版本插件的问题,这里有人建议使用旧版本并清除它。也许你可以试试 <gap:plugin name="org.apache.cordova.splashscreen" version="2.0.0" source="npm" /> ... 你也在使用 <preference name="AutoHideSplashScreen" value="false"/>这意味着您需要手动隐藏启动画面。在 cdn 之前在 index.html 上使用 jquery mobile

<script>document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);
}<script>

https://github.com/apache/cordova-plugin-splashscreen

我不确定您使用的是什么平台,但这也是需要考虑的问题。您也可以尝试使用 <preference name="AutoHideSplashScreen" value="true"/>

关于cordova - 使用 Cordova/Phonegap 构建的应用程序启动后卡在黑屏上,安装后首次加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34043988/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com