【问题标题】:How to resolve white screen on ionic application (ios)如何解决离子应用程序(ios)上的白屏
【发布时间】:2020-11-12 12:55:10
【问题描述】:

我的应用在设备上显示白屏,但它在浏览器和模拟器中正确运行。我尝试了很多解决方案,但没有一个对我有用。我还使用ionic run ios -l -c 命令查看控制台日志中的错误,但没有显示任何错误。

有人对我如何调试此问题有任何建议吗?

【问题讨论】:

  • 你的 xcode 、 OS 和 ios 版本是多少?
  • xcode 8.3.3 , os sierra 和 ios 版本 9.3

标签: ios iphone ionic-framework


【解决方案1】:

IOS 在最新版本的 IOS 中已弃用 UIWebview。

  1. 使用以下命令在 ionic 项目中安装 WKWebview 插件

    cordova-plugin-ionic-webview

  2. 使用以下命令从 ionic 项目中删除 ios 平台

    离子科尔多瓦平台rm ios

  3. 打开 ionic 项目的 config.xml 文件,将下面这行代码放入 ios platform ( )

在 steap 之后你的 config.xml 文件代码看起来像

<platform name="ios">
<preference name="WKWebViewOnly" value="true" />

<feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
  1. 添加Readd ios平台

    ionic cordova 平台添加 ios

【讨论】:

    【解决方案2】:

    我也遇到了同样的问题:

    但您可以将您的 html 页面内容替换为 &lt;ion-content&gt;&lt;ion-scroll&gt;.. 并设置 overflow-scroll="false"

    另一件事是在您的 config.xml 文件中检查是否设置了所有这些值

    <preference name="SplashScreenDelay" value="2000"/>
    <preference name="FadeSplashScreenDuration" value="2000"/>
    <preference name="SplashScreen" value="screen"/>
    <preference name="ShowSplashScreenSpinner" value="false"/>
    <preference name="AutoHideSplashScreen" value="false" />
    

    并通过添加此行来更改 app.js 文件

    $ionicConfigProvider.views.swipeBackEnabled(false);
    

    【讨论】:

      【解决方案3】:

      我最近遇到了类似的问题。删除 node_modules、platforms 和 plugins 目录后是否可以尝试执行全新安装。

      如果它不起作用,请像这样更新您的 app.component.ts。

      import { SplashScreen } from '@ionic-native/splash-screen';
      
      export class MyApp {
         ...
         constructor(... public splashScreen: SplashScreen, ...) {
      
         this.initializeApp();
      
      }
      
      initializeApp() {
      
        this.platform.ready().then(() => {
          ...
      
          setTimeout(() => {
            this.splashScreen.hide();
          }, 2000);
      
          ...
      
        });
      }
      

      在您的 config.xml 中设置此参数。

      <preference name="AutoHideSplashScreen" value="false" />
      <preference name="SplashShowOnlyFirstTime" value="false" />
      <preference name="ShowSplashScreen" value="false" />
      <preference name="SplashScreenDelay" value="3000" />
      <preference name="ShowSplashScreenSpinner" value="false" />
      <preference name="FadeSplashScreen" value="false" />
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-11-03
        • 1970-01-01
        • 2019-02-06
        • 2022-07-11
        • 1970-01-01
        • 2016-09-20
        • 2020-09-24
        • 1970-01-01
        相关资源
        最近更新 更多