xcode 缺少 default-568h@2x 启动图像,启动图像不会显示

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

Missing default-568h@2x launch image, launch image won't display

iosxcode

提问by SaleenS7

I set up the launch images as so, XCode forced me to rename the images which is ok, but for some reason when I run iOS Simulator, there is no launch image displayed. Instead, a black screen is displayed. Previously I had the warning Missing default-568h@2x launch imagewhich went away when I clicked add on the menu that was popping up when I expanded the warning. However the launch images still do not display when launching the app. I have tried resetting all content, cleaning, building, and then running again, but nothing seems to be working. Additionally, XCode did not rename any of my images to default568h@2xso I'm assuming that is a problem, even after I clicked add. I do have launch image set to default in info.plist.

我这样设置启动图像,XCode 强迫我重命名图像,这没问题,但是由于某种原因,当我运行 iOS 模拟器时,没有显示启动图像。而是显示黑屏。以前Missing default-568h@2x launch image,当我在展开警告时弹出的菜单上单击添加时,警告消失了。但是,启动应用程序时仍不显示启动图像。我尝试重置所有内容、清理、构建,然后再次运行,但似乎没有任何效果。此外,XCode 没有将我的任何图像重命名为,default568h@2x因此我认为这是一个问题,即使在我单击添加之后也是如此。我确实在 info.plist 中将启动图像设置为默认值。

Any suggestions?

有什么建议?

采纳答案by V-Xtreme

I am guessing but just try following steps :

我在猜测,但只需尝试以下步骤:

  1. Go to the launch image path in your resources .
  2. Copy paste your image and give the same name default-568h@2x
  3. Try to clean and build the project .
  4. Then also if you are not seeing the image then just simply delete the application and install it again .
  1. 转到资源中的启动图像路径。
  2. 复制粘贴您的图像并赋予相同的名称 default-568h@2x
  3. 尝试清理和构建项目。
  4. 然后,如果您没有看到图像,则只需删除该应用程序并重新安装即可。

回答by FisherMartyn

I meet the same problem, but the result comes out because i changed the Launch Image Source Setting. Here is how I fix it:

我遇到了同样的问题,但结果出来了,因为我更改了启动图像源设置。这是我修复它的方法:

  1. Go to the target in the Project Editor
  2. Select the General tab
  3. Find the "APP Icons and Launch Images" section and click "Launch Images Source"
  4. If the current state is "Use Asset Catalog", select "Migrate".
  1. 在项目编辑器中转到目标
  2. 选择常规选项卡
  3. 找到“应用程序图标和启动图像”部分,然后单击“启动图像源”
  4. 如果当前状态为“使用资产目录”,则选择“迁移”。

Problem Solved.

问题解决了。

回答by Bill Feth

Xcode 11 outputs this error if you move your Info.plist file and forget to tell Xcode about the new location in Build Settings.

如果您移动 Info.plist 文件并忘记将 Build Settings 中的新位置告诉 Xcode,Xcode 11 会输出此错误。

The Info.plist contains metadata about your LaunchScreen storyboard/image. Apparently, Xcode assumes you want to use a launch image (and did not provide one) when it cannot find the target's Info.plist file. Updating the Info.plist location in Build Settings fixes this disconnect:

Info.plist 包含有关 LaunchScreen 故事板/图像的元数据。显然,当 Xcode 找不到目标的 Info.plist 文件时,它假定您想使用启动图像(但没有提供)。更新 Build Settings 中的 Info.plist 位置可修复此断开连接:

  1. Select the Project file (top item) in the sidebar.
  2. Select the Target in the Project editor.
  3. Select the Build Settings tab in the Project editor.
  4. Scroll/search for "plist", or "INFOPLIST_FILE" to be exact.
  5. Double-click the plist entry to edit it, and type in the correct location for the Info.plist file. (e.g. if you moved it to a Resources folder within the MyGreatApp project root folder, set the value to "MyGreatApp/Resources/Info.plist")
  1. 在侧栏中选择项目文件(顶部项目)。
  2. 在项目编辑器中选择目标。
  3. 在项目编辑器中选择 Build Settings 选项卡。
  4. 确切地说,滚动/搜索“plist”或“INFOPLIST_FILE”。
  5. 双击 plist 条目进行编辑,然后输入 Info.plist 文件的正确位置。(例如,如果您将其移动到 MyGreatApp 项目根文件夹中的 Resources 文件夹,请将值设置为“MyGreatApp/Resources/Info.plist”)

This is not the OP's situation (they intended to use launch images), but I thought I would add this breadcrumb for anyone like me who got this error after moving an Info.plist file.

这不是 OP 的情况(他们打算使用启动图像),但我想我会为像我这样在移动 Info.plist 文件后遇到此错误的任何人添加此面包屑。

回答by mrbengi

No need to name a file like that.

无需像这样命名文件。

Just doing this solves the problem :

这样做就可以解决问题:

1.Add launch images inside assets by right click / add new files.
By doing this, you will add launge images set. enter image description here

1.通过右键单击/添加新文件在资产中添加启动图像。
通过这样做,您将添加 launge 图像集。 在此处输入图片说明

2.Then set all of these launge images.
To see the sizes do these : Select the image then you can check the size on the property inspector at right. Like this:
enter image description here

2.然后设置所有这些 launge 图像。
要查看尺寸,请执行以下操作:选择图像,然后您可以在右侧的属性检查器上检查尺寸。像这样:
在此处输入图片说明

回答by mike123

  1. Clean project
  2. Build project
  3. Toggle issue navigator window
  4. In the issue navigator window there will be a warning message saying Missing [email protected]
  5. Click that issue
  6. The dialog will come up prompting to add the missing file
  7. Hitting add will place the file (all black in colour) into the root of the project
  8. Issue solved
  1. 清洁工程
  2. 构建项目
  3. 切换问题导航器窗口
  4. 在问题导航器窗口中将出现一条警告消息,指出 Missing [email protected]
  5. 点击那个问题
  6. 将出现对话框提示添加丢失的文件
  7. 点击添加会将文件(全黑色)放入项目的根目录中
  8. 问题已解决

回答by danielhadar

If (as opposed to all the previous answers) you're not interested in any launch image at all (i.e.the error appeared after deleting it), the following suffices:

如果(与之前的所有答案相反)您对任何启动图像根本不感兴趣(删除它后出现错误),以下就足够了:

1. Product > Clean

1. 产品 > 清洁

2. Product > Build

2. 产品 > 构建

回答by Frank

I am using Xcode 11.3.1, and I just did a project clean up, this warning is gone:

我正在使用Xcode 11.3.1,我刚刚做了一个项目清理,这个警告消失了:

  1. ?+ ?+ Kto Clean Build Folder.

  2. Close Xcode.

  3. Re-open Xcode.

  4. Re-build project.

  1. ?+ ?+KClean Build Folder

  2. 关闭 Xcode。

  3. 重新打开Xcode。

  4. 重新构建项目。