iOS 9 启动画面是黑色的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32627519/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 07:40:16  来源:igfitidea点击:

iOS 9 Splash screen is black

iosxcodesplash-screenios9xcode7

提问by andrrs

My apps' splash screens are all plain black after upgrading to iOS9.

升级到 iOS9 后,我的应用程序的启动画面都是纯黑色的。

Does anybody know why this is? Some of them are using a .xib splash screen and some are using images, but they're all just black now. Does an app have to be built with Xcode 7 for the splash screen to work in iOS9? Has anyone seen some documentation on whether this is an intended breaking change from Apple?

有人知道这是为什么吗?他们中的一些人使用 .xib 启动画面,一些人使用图像,但现在它们都是黑色的。是否必须使用 Xcode 7 构建应用程序才能在 iOS9 中运行启动画面?有没有人看过一些关于这是否是 Apple 有意的重大更改的文档?

Thank you!

谢谢!

UPDATE:Looking through the apps again it seems my older apps, which only had a Launch image and no .xib are still displaying correctly, so the issue seems related to the launch screen .xib

更新:再次查看应用程序,似乎我的旧应用程序(只有启动图像而没有 .xib)仍能正确显示,因此问题似乎与启动屏幕 .xib 有关

UPDATE2:As hagipointed out in the comment, after re-installing the very same binary it starts working again so the cause is probably that launch images are generated from the xib whenever the app is installed, and stored somewhere, and then when upgrading to iOS9, for some reason (unintended Apple bug most likely), the generated images are cleared, and the app ends up with no splash. And that's why the old-fashioned launch images are still safe and not affected by this, cause they're already baked into the app.

UPDATE2:作为在评论中指出,经过重新安装它再次开始工作非常相同的二进制这样的原因可能是这次发射的图像从只要安装该应用程序的厦门国际银行产生和存储的地方,然后在升级到iOS9,出于某种原因(最有可能是无意的 Apple 错误),生成的图像被清除,应用程序最终没有飞溅。这就是为什么老式的启动图像仍然安全且不受此影响的原因,因为它们已经被嵌入到应用程序中。

I'll report it as a bug to Apple.

我会将其作为错误报告给 Apple。

采纳答案by shady

Same problem here after I updated to iOS 9. Re-installing the app from the App Store seems to solve the problem. I guess, it's an iOS 9 glitch.

我更新到 iOS 9 后也出现同样的问题。从 App Store 重新安装应用程序似乎解决了问题。我想,这是一个 iOS 9 故障。

回答by TokyoToo

Easy fix. No need to mess with anything. Xcode 7 just prefers the images to be "Universal".

轻松修复。没有必要搞砸任何事情。Xcode 7 只是更喜欢图像是“通用的”。

  1. Click on Assets.xcassets folder
  2. Click the + sign to Import from Project.
  3. Select all images
  1. 单击 Assets.xcassets 文件夹
  2. 单击 + 号以从项目导入。
  3. 选择所有图像

Done. Now your launch screen works and Xcode is happier.

完毕。现在你的启动屏幕可以工作了,Xcode 更开心了。

回答by zai chang

I had the exact problem and had a black launch screen after using Xcode 7, and at first re-adding the images in Launch-Screen.xib worked but it went black again.

使用 Xcode 7 后,我遇到了确切的问题,启动屏幕是黑色的,起初在 Launch-Screen.xib 中重新添加图像有效,但它又变黑了。

I fixed this permanently by moving the images referenced by Launch-Screen.xib into an asset catalog, rather than using the png filenames.

我通过将 Launch-Screen.xib 引用的图像移动到资产目录中来永久修复此问题,而不是使用 png 文件名。

回答by Pallavi Ligade

  1. Black screen default come because, iOS strictly enforces some a startup images it can be black or any images.
  2. Use UILaunchImages key to the Info.plist file and use a dictionary to describe each launch image. Change setting in your project to ppoin towards Asset Catalog
  3. check following references
  1. 黑屏默认来是因为,iOS 严格执行一些启动图像,它可以是黑色或任何图像。
  2. 使用 Info.plist 文件的 UILaunchImages 键并使用字典来描述每个启动图像。 将项目中的设置更改为指向资产目录
  3. 检查以下参考资料

I hope above information will help you.

希望以上信息对您有所帮助。

回答by Agat

Just to point out that once again (as this solution didn't appear in answers, and I've personally lost around two hours when "fixing" that), sometimes, especially when the app is in active development/debugging, it requires iOS device to rebootfor the launch screen to be fixed.

再次指出这一点(因为这个解决方案没有出现在答案中,我个人在“修复”这个问题时损失了大约两个小时),有时,尤其是当应用程序处于活跃的开发/调试状态时,它需要 iOS设备重新启动以修复启动屏幕。

回答by EralpB

With me uninstalling the app, or rebooting the device didn't help. I used XCode for 5 more minutes, which is the mean time between failure in XCode and it gave "Unkown error occurred" error, which was very helpful. Of course as an experienced XCode developer I knew what to do, force-quit, clean the project, rebuild.

我卸载应用程序或重新启动设备都没有帮助。我又使用了 5 分钟的 XCode,这是 XCode 失败之间的平均时间,它给出了“发生未知错误”错误,这非常有帮助。当然,作为一名经验丰富的 XCode 开发人员,我知道该怎么做、强制退出、清理项目、重建。

The first error was solved meanwhile as I had forgotten about that.

由于我忘记了这一点,同时解决了第一个错误。

回答by Ivan

I have fixed this issue after removed Size Classesfor LaunchScreen.xibI used only Auto Layoutfor it.

删除后我已经解决了这个问题,Size Classes因为LaunchScreen.xib我只Auto Layout用于它。

回答by Hwangho Kim

In the storyboard 'Clears Graphics Context' box unchecked then It works.

在情节提要中取消选中“清除图形上下文”框,然后它就可以工作了。

回答by Dinh Viet Phu

The problem maybe because missing image size: .png, @2x.png, @3x.png at LaunchScreen.xib

问题可能是因为在 LaunchScreen.xib 上缺少图像大小:.png、@2x.png、@3x.png

I made loading screen by LaunchScreen.xib In this xib has load a image launch.png But there are missing size launch.png, just exist [email protected] and [email protected] After add missing image: launch.png, black square bug is gone.

我通过 LaunchScreen.xib 制作了加载屏幕 在这个 xib 加载了一个图像 launch.png 但是缺少大小的 launch.png,只存在 [email protected][email protected] 添加丢失的图像后:launch.png,黑色方块虫不见了。

回答by Tà Truhoada

Starting from iOS9 and Xcode 7 you are required to provide a LaunchScreen.storyboard for your launch screen in order to support the new multitasking feature on iPad.

从 iOS9 和 Xcode 7 开始,您需要为启动屏幕提供 LaunchScreen.storyboard 以支持 iPad 上的新多任务处理功能。

To opt out of being eligible to participate in Slide Over and Split View, add the UIRequiresFullScreen key to your Xcode project's Info.plist file and apply the Boolean value YES.

要选择不参加 Slide Over 和 Split View,请将 UIRequiresFullScreen 键添加到您的 Xcode 项目的 Info.plist 文件并应用布尔值 YES。