首页 > 解决方案 > 缺少图标 - 如何添加 Xcode appicon 模板中不可用的图标?

问题描述

我正在使用 Xcode 10.0,但由于各种原因无法更新到 Xcode 10.1。我需要包含提交应用程序所需的 WatchApp 图标(50x50 和 108x108),但这些集在 10.0 的模板中不可用,我想它们已添加到 10.1。即使在我的 Xcode 版本中没有标记为 50x50 和 108x108 的插槽,我如何手动包含此图标?

我正在尝试将图标直接添加到图标集文件夹中,图标出现在 Xcode 上,但我看到了这个警告......

Warning: The app icon set "AppIcon" has 2 unassigned children

标签: iosxcode

解决方案


您可以尝试手动更新 Contents.json 文件。

这是我的所有图标的样子,您可以使用它作为基础,在您的图标中添加缺少的部分:

{
  "images" : [
    {
      "size" : "24x24",
      "idiom" : "watch",
      "filename" : "Icon-24@2x.png",
      "scale" : "2x",
      "role" : "notificationCenter",
      "subtype" : "38mm"
    },
    {
      "size" : "27.5x27.5",
      "idiom" : "watch",
      "filename" : "Icon-27.png",
      "scale" : "2x",
      "role" : "notificationCenter",
      "subtype" : "42mm"
    },
    {
      "size" : "29x29",
      "idiom" : "watch",
      "filename" : "Icon-29@2x.png",
      "role" : "companionSettings",
      "scale" : "2x"
    },
    {
      "size" : "29x29",
      "idiom" : "watch",
      "filename" : "Icon-29@3x.png",
      "role" : "companionSettings",
      "scale" : "3x"
    },
    {
      "size" : "40x40",
      "idiom" : "watch",
      "filename" : "Icon-40@2x.png",
      "scale" : "2x",
      "role" : "appLauncher",
      "subtype" : "38mm"
    },
    {
      "size" : "44x44",
      "idiom" : "watch",
      "filename" : "Icon-44@2x.png",
      "scale" : "2x",
      "role" : "appLauncher",
      "subtype" : "40mm"
    },
    {
      "size" : "50x50",
      "idiom" : "watch",
      "filename" : "Icon-50@2x.png",
      "scale" : "2x",
      "role" : "appLauncher",
      "subtype" : "44mm"
    },
    {
      "size" : "86x86",
      "idiom" : "watch",
      "filename" : "Icon-86@2x.png",
      "scale" : "2x",
      "role" : "quickLook",
      "subtype" : "38mm"
    },
    {
      "size" : "98x98",
      "idiom" : "watch",
      "filename" : "Icon-98@2x.png",
      "scale" : "2x",
      "role" : "quickLook",
      "subtype" : "42mm"
    },
    {
      "size" : "108x108",
      "idiom" : "watch",
      "filename" : "Icon-108@2x.png",
      "scale" : "2x",
      "role" : "quickLook",
      "subtype" : "44mm"
    },
    {
      "size" : "1024x1024",
      "idiom" : "watch-marketing",
      "filename" : "Icon-1024.png",
      "scale" : "1x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

推荐阅读