gpt4 book ai didi

ionic2 - 启动画面后的白屏,Ionic2,Android 设备

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

我目前正在开发 Ionic2 应用程序。我遇到一个问题,在启动画面之后,在应用主屏幕之前,有 6-7 秒的白屏。

我尝试了一些谷歌搜索,但没有任何效果。我最后尝试解决的是

    hideSplashScreen() {
if(Splashscreen){
setTimeout(() => {
Splashscreen.hide();
},100)
}
};//

<preference name="SplashMaintainAspectRatio" value="true"/>
<preference name="FadeSplashScreenDuration" value="300"/>

请帮助我解决这个问题;

编辑:我的 ionic info
Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: 1.8.6
OS: OS X El Capitan
Node Version: v6.3.1
Xcode version: Xcode 7.2 Build version 7C68

最佳答案

更新中 ionic 项目并改变一些偏好对我有用。

这里changelog and infos .

1 - 更新到最新版本的 Ionic CLI , CordovaTypescript :

npm uninstall -g ionic cordova typescript
npm install -g ionic cordova typescript

2 - 更新您的 package.json 要匹配以下依赖项,请删除现有 node_modules 目录 ,然后运行 ​​ npm install :
  "scripts": {
"build": "ionic-app-scripts build",
"clean": "ionic-app-scripts clean",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.0.2",
"@angular/compiler": "4.0.2",
"@angular/compiler-cli": "4.0.2",
"@angular/core": "4.0.2",
"@angular/forms": "4.0.2",
"@angular/http": "4.0.2",
"@angular/platform-browser": "4.0.2",
"@angular/platform-browser-dynamic": "4.0.2",
"@ionic-native/core": "3.6.1",
"@ionic-native/in-app-browser": "3.6.1",
"@ionic-native/splash-screen": "3.6.1",
"@ionic-native/status-bar": "3.6.1",
"@ionic/storage": "2.0.1",
"ionic-angular": "3.1.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "0.8.9"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.6",
"typescript": "2.3.2"
}

3 - 更新您的 config.xlm 有这些偏好(实时评论是可以的):
  <preference name="loadUrlTimeoutValue" value="700000"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="android-minSdkVersion" value="16"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="StatusBarStyle" value="default"/>
<preference name="SplashScreen" value="screen"/>
<preference name="orientation" value="default"/>
<preference name="SplashMaintainAspectRatio" value="true"/>
<preference name="FadeSplashScreenDuration" value="300"/>
<preference name="ShowSplashScreenSpinner" value="false"/>
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine"/>
<preference name="SplashScreenDelay" value="3000"/>

4 - 然后我复制/粘贴了一些最近从 here 修改过的代码进入我的项目(Ionic 2 演示和最新的应用程序 - 检查 Github)。

现在应用程序成功启动,没有很长的启动画面。

ps:
  • 实况评论:ionic run android -l
  • 生产:ionic run android --prod --release
  • 请记住,您必须在 中手动隐藏启动画面(如@Markus Wagner 所说)。 app.component.ts :this.platform.ready().then(() => { Splashscreen.hide(); });

  • 编辑:更新到 Ionic v3.1.1 (2017-04-28)

    关于ionic2 - 启动画面后的白屏,Ionic2,Android 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41544016/

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