Cordova 3.4 iOS 启动后出现白屏 [英] Cordova 3.4 iOS white screen after splash

查看:94
本文介绍了Cordova 3.4 iOS 启动后出现白屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在浏览有关此问题的一些不同帖子,但没有任何内容可以解决我的问题.

在我的启动画面加载并显示约 2 秒后,会出现一个白屏,显示约 2 秒,然后显示应用内容.

此问题仅在 iOS 上存在,并且仅在我使用 iOS 6.1 和 7 在 3.5" 上运行模拟器时存在.

我有

所以我可以手动控制启动画面何时隐藏在 deviceready 事件中:

function onDeviceReady() {setTimeout(function () {navigator.splashscreen.hide()},2000);//更多东西}

问题是这并不能阻止闪屏过早隐藏.除了加载微调器在 2000 年之后消失之外,我看到了完全相同的行为.

Sooo..这到底是怎么回事?

解决方案

我有同样的问题 (Cordova 3.4),但我在这里解决了.

这似乎是 CDVSplashScreen 中的某种错误.请注意它在输出中如何说它找不到图像默认肖像".(它应该寻找另一个文件,Default",而不是Default-Portrait".)

<块引用>

警告:未找到名为 Default-Portrait 的启动画面图像

我做了以下事情:

  • 创建一个名为 Default-Portrait@2x~iphone.png(Default@2x~iphone.png 的副本)的新启动画面并添加它到资源下的启动目录.(如果您需要支持 iOS 6,您可能还需要一个 Default-Portrait~iphone.png 文件.)不要只是重命名文件,否则 Xcode 可能不会构建您的由于文件丢失而导致的项目.

  • 确保您还确保此新文件在您的项目列表中.(我没有使用 cordova build ios 重建项目,所以我不得不将文件从 finder 拖到 Xcode 中的项目文件中.不确定重建是否会自动将其添加到您的 Xcode 项目中.)p>

这应该可以解决您的问题.

我刚刚切换到 Xcode 5.1 和 iOS 7.1,Cordova 也遇到了新 SDK 的一些问题.如果您偶然发现 Xcode 5.1 & 的一些问题iOS 7.1,我还想把你链接到以下页面.

I have been looking around at a few different posts on here concerning this issue and nothing has solved my problem.

After my splash screen loads and displays for ~2 seconds there is a white screen that shows for about 2 seconds and then the app content displays.

This issue only exists on iOS and only when I run the emulator on 3.5" with iOS 6.1 and 7.

I have

<preference name="AutoHideSplashScreen" value="false" /> 

so I can manually control when the splash screen hides in the deviceready event as such:

function onDeviceReady() {
    setTimeout(function () {navigator.splashscreen.hide()},2000);
        //more stuff
}

The problem is that this doesn't stop splashscreen from hiding prematurely. I see the exact same behavior except the loading spinner does disappear after 2000.

Sooo..what the heck is going on?

解决方案

I have the same problem (Cordova 3.4), but I solved it here.

It seems to be some kind of bug in CDVSplashScreen. Notice how it says in the Output that it couldn't find the image "Default-Portrait". (It should be looking for another file, "Default", not "Default-Portrait".)

WARNING: The splashscreen image named Default-Portrait was not found

What I did was the following:

  • Create a new splash screen named Default-Portrait@2x~iphone.png (a copy of Default@2x~iphone.png) and add it to the splash directory under Resources. (If you need to support iOS 6 you'll probably need a Default-Portrait~iphone.png file as well.) Don't just rename the file, or Xcode might not build your project due to a missing file.

  • Ensure that you also make sure that this new file is in your project list. (I didn't rebuild the project with cordova build ios so I had to drag the file from finder to the project files in Xcode. Not sure if rebuilding automatically adds it to your Xcode project.)

This should solve your problem.

I just switched to Xcode 5.1 and iOS 7.1 and Cordova has some issues with the new SDK as well. If you stumble upon some issues with Xcode 5.1 & iOS 7.1, I would also like to link you to the following page.

这篇关于Cordova 3.4 iOS 启动后出现白屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆