Xcode 11 UILaunchImages 已被弃用,请改用启动故事板警告

Xcode 11 UILaunchImages has been deprecated, use launch storyboards instead Warning

我刚刚下载了 Xcode 11 Beta 4,当我想要构建我的 Swift 4 项目时,我得到了:

UILaunchImages has been deprecated, use launch storyboards instead

我该如何解决?

请阅读release notes for Xcode 11 beta 4:

Known Issues

Your app might fail to build if it contains a launch image. The failure message resembles the following: “The launch image set named <image set name> did not have any applicable content.” Launch images are deprecated and should be removed; use a launch storyboard or .xib file instead. (50210495)

Workaround: Clear the build setting ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME.

  • 向您的项目添加新故事板
  • 将其命名为 LaunchScreen.storyboard 并保存
  • 向您的 LaunchScreen 添加一个新的视图控制器,添加一个 imageView,然后 参考您的启动图片
  • 将LaunchScreen.storyboard设为您的初始视图控制器 属性检查器(确保取消选中旧的初始视图 控制器)
  • 在启动屏幕文件下拉列表中的常规设置(应用程序图标和启动图像)中,select LaunchScreen

经过测试,要消除编译器警告,请删除 Images.xcassets 中的 LaunchImage 文件夹,然后在构建设置中,从资产目录启动图像集名称中删除 LaunchImage(在调试和发布中)。

就我而言,发生了一些事情...

  1. 我的 Info.plist 文件 UILaunchImages 导致了这个警告。删除后,警告消失了。
  2. 在我的 ProjectTragetGeneral 选项卡上,Launch Screen File 是空的。因此,从下拉列表中添加我的启动屏幕文件使我的应用程序再次正确启动(这是我的主要情节提要文件)。

我希望这能帮助遇到同样警告的其他人,也能帮助他们的应用看起来像信箱一样。

  1. Xcode -> 文件 -> 新建 -> 文件... -> 启动屏幕。

  2. Select 目标 -> 构建设置 -> 搜索 "LaunchImage" & 从(调试和发布)资产目录启动图像集名称中删除字符串。

  3. Select "Assets.xcassets" 并从中删除 LaunchImage。

  4. 建设&运行.......享受