ios 黑屏而不是 iPad 上的启动图像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19219291/
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 02:09:04  来源:igfitidea点击:

Black screen instead of launch image on iPad

iphoneiosobjective-cxcodeipad

提问by nicky_1525

I am developing an iPhone app for iOS 6.1 and 7 (using Xcode 5). I have a problem with iPad launch images.

我正在为 iOS 6.1 和 7(使用 Xcode 5)开发一个 iPhone 应用程序。iPad 启动图像有问题。

On iPad 7.0 and 7.0.2, the launch image is not showing up(in 6.1 works!): I get black screen while app is loading.

在 iPad 7.0 和 7.0.2 上,未显示启动图像(在 6.1 中有效!):我在加载应用程序时出现黑屏。

I don't face this issue with iPhone 6.1 and 7.0.2, although I set all launch images required for iPad and iPad retina (landscape and portrait) and I use Asset Catalog.

我在 iPhone 6.1 和 7.0.2 上没有遇到这个问题,尽管我设置了 iPad 和 iPad 视网膜(横向和纵向)所需的所有启动图像,并且我使用了资产目录。

What am I missing?

我错过了什么?

采纳答案by nicky_1525

I requested Apple support and it turned out that it's a bug. They asked me to report it and I did. Here is the report id : 15340531. Now it's up to them.

我请求 Apple 支持,结果发现这是一个错误。他们让我报告,我照做了。这是报告 ID:15340531。现在由他们决定。

回答by Samyukt Shah

Recently I faced same issue with my App designed only for iPhone , I had the problem where the launch images would not appear in iPad (On iPad ios >= 7.0.x the launch image is not showing up I get black screen while app is loading (in iPad ios < 7.0.x it works fine )).

最近我的应用程序只为 iPhone 设计,我遇到了同样的问题,我遇到了启动图像不会出现在 iPad 中的问题(在 iPad ios >= 7.0.x 上,启动图像没有显示我在加载应用程序时出现黑屏(在 iPad ios < 7.0.x 中它工作正常))。

I don't face this issue of launch image with iPhone worked fine in all iOS versions.

我没有遇到这个问题,iPhone 在所有 iOS 版本中都运行良好。

Solution: Is to update to asset catalog to manage your app's images and target only iOS 6 and Prior.

解决方案:更新到资产目录以管理您的应用程序的图像并仅针对 iOS 6 和之前的版本。

Steps :

脚步 :

Step 1:

第1步:

Update to Asset Catalog

更新到资产目录

Step 2:

第2步:

Select to Migrate

选择迁移

Step 3: on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images.

第 3 步:在右上角单击“属性检查器”图标。您可以在此处设置启动映像的目标操作系统。

Uncheck the iOS 7 check boxes for iPhone

取消选中 iPhone 的 iOS 7 复选框

Uncheck the iOS 7 check boxes for iPhone, Now you should be able to see the launch images for iPad on iOS >= 7.0.x.

取消选中 iPhone 的 iOS 7 复选框,现在您应该能够在 iOS >= 7.0.x 上看到 iPad 的启动图像。

回答by djdance

If you have the same situation like mine, that's solution:

如果你有和我一样的情况,那就是解决方案:

My app is landscape only, iOs7 only, ipad\iphone (XCode 5).

我的应用程序仅限横向,仅限 iOs7,ipad\iphone (XCode 5)。

Problem:black launch on iphone (and simulator), normal launch in ipad.

问题:在 iphone(和模拟器)上启动黑色,在 ipad 中正常启动。

Solution: go to Images.xcassets - Launch Images - select it. Uncheck at right all "iOs7 and later"boxes. Check "iOs6 and prior"boxes and fill empty spaces with images.

解决方案:转到 Images.xcassets - Launch Images - 选择它。取消选中所有“iOs7 及更高版本”框。选中“iOs6 及之前”框并用图像填充空白区域。

Strange, but works.

奇怪,但有效。

回答by Tommie C.

Per Apple's documentation (link); an empty iPad specific storyboard may be the answer. I've also seen issues where the initial view controller is not set within a storyboard causes a black screen. A variant of this issue might be an incorrect setting in the app plist.

根据 Apple 的文档(链接);一个空的 iPad 特定故事板可能就是答案。我还看到了在情节提要中未设置初始视图控制器导致黑屏的问题。此问题的一个变体可能是应用程序 plist 中的设置不正确。

Technical Q&A QA1780 Why does my app launch to a black screen on iPad?

技术问答 QA1780 为什么我的应用程序在 iPad 上启动时出现黑屏?

Q: Why does my app launch to a black screen on iPad?

问:为什么我的应用程序在 iPad 上启动时黑屏?

A: Apps that have been designed only for iPhone may launch to a blank screen when run on an iPad. This is caused by the presence of an empty iPad specific storyboard in the app bundle as well as an iPad specific UIMainStoryboardFile key in the app's Information Property List (Info.plist) file. Both are automatically created by the various Xcode template projects if the Universal option is selected.

答:专为 iPhone 设计的应用程序在 iPad 上运行时可能会启动到空白屏幕。这是由于应用程序包中存在空的 iPad 特定故事板以及应用程序的信息属性列表 (Info.plist) 文件中的 iPad 特定 UIMainStoryboardFile 键造成的。如果选择了 Universal 选项,两者都是由各种 Xcode 模板项目自动创建的。

...

...

In Xcode

在 Xcode 中

Look for a file named MainStoryboard_iPad.storyboard in the file navigator. If this file is present, remove it from your project.

在文件导航器中查找名为 MainStoryboard_iPad.storyboard 的文件。如果此文件存在,请将其从您的项目中删除。

In your app's Information Property List

在您应用的信息属性列表中

Look for a key named Main storyboard file base name (iPad) or UIMainStoryboardFile~ipad. If this key is present, remove it. You should also remove any other key suffixed with (iPad) or ~ipad.

查找名为 Main storyboard file base name (iPad) 或 UIMainStoryboardFile~ipad 的键。如果此键存在,请将其删除。您还应该删除以 (iPad) 或 ~ipad 为后缀的任何其他键。

Finally, test your app on an iPad or in the iPad simulator and verify that it behaves as expected.

最后,在 iPad 或 iPad 模拟器中测试您的应用程序并验证它的行为是否符合预期。

回答by Suragch

Using LaunchScreen.storyboard

使用 LaunchScreen.storyboard

I was having a similar problem until I found the following settings in the General Project Settings.

我遇到了类似的问题,直到我在General Project Settings 中找到以下设置。

  1. Set your Main Interfaceto your main storyboard file. Mine is called Main.storyboard.
  1. 将您的主界面设置为您的主故事板文件。我的叫做Main.storyboard

enter image description here

在此处输入图片说明

  1. Set your Launch Screen Fileto your launch screen storyboard file. Mine is called LaunchScreen.storyboard. (This is what I had originally ommited.)
  1. 启动屏幕文件设置为启动屏幕故事板文件。我的叫做LaunchScreen.storyboard。(这是我最初忽略的内容。)

enter image description here

在此处输入图片说明

After that the launch screen loaded first and then the main story board loaded shortly later.

之后,首先加载启动屏幕,然后不久加载主故事板。

回答by Suragch

Try set the image again make sure that resolution of the splash screen is according to the iOS 7 guidelines

再次尝试设置图像,确保启动画面的分辨率符合 iOS 7 指南

回答by Jodocus

I know this sounds stupid. I've had bugs like that when I saved a file in psd-format with a jpg extension. Just 1 wrong click while saving your launch image.

我知道这听起来很愚蠢。当我用 jpg 扩展名以 psd 格式保存文件时,我遇到过这样的错误。保存启动图像时只需单击 1 次错误。

回答by phbardon

After having tried several solutions found here, I suspected that the iPhone was trying to launch in Landscape orientation, and thus not finding any corresponding launch image. Indeed, the simulator was starting in Landscape for a reason I was not understanding.

在尝试了这里找到的几种解决方案后,我怀疑 iPhone 试图以横向启动,因此没有找到任何相应的启动图像。事实上,模拟器在 Landscape 中启动是出于我不理解的原因。

Finally, after reading Apple documentation, I found that it's probably the order of keys in "Supported interface orientations" of the info.plist file that was not adequate. The Portrait was the last item. When it's the first item, the app launch in Portrait mode and find the image.

最后,在阅读 Apple 文档后,我发现可能是 info.plist 文件的“支持的界面方向”中的键顺序不够用。肖像是最后一项。当它是第一项时,应用程序以纵向模式启动并找到图像。

回答by Alex M

I had the problem where the launch images would no appear in iPhone (3.5 or 4 inch) in iOS 7, but the iPad had no problems with iOS 7.

我遇到了启动图像不会出现在 iOS 7 中的 iPhone(3.5 或 4 英寸)中的问题,但 iPad 在 iOS 7 中没有问题。

Long story short is I disabled the asset catalog for the launch images only. So I'm adding the launch images the old fashioned way. That seems to have solved the problem.

长话短说,我仅禁用了启动图像的资产目录。所以我以老式的方式添加启动图像。这似乎解决了问题。

I will have to do more testing tomorrow, but it seems the problem is solved (at least in my case).

明天我将不得不进行更多测试,但问题似乎已解决(至少在我的情况下)。

回答by Sanjeev sharma

Remove previously installed app from the device or simulator, Then relaunch the app after clean.

从设备或模拟器中删除以前安装的应用程序,然后在清理后重新启动应用程序。