Xcode15 - “backgroundImage”颜色资源名称解析为已存在的符号“background”。尝试重命名资产

问题描述 投票:0回答:1

我在 Xcode15 上构建 iOS 项目,收到警告:

The "backgroundImage" color asset name resolves to the symbol "background" which already exists. 
Try renaming the asset.

我的资源包括两种颜色:“背景”和“背景图像”。 Xcode 自动生成以下代码:

背景

/// The "background" asset catalog color resource.
static let background = ColorResource(name: "background", bundle: resourceBundle)

但是,backgroundImage颜色导致了上述警告。

我知道 Xcode 15 可以自动为您的资源创建 Swift 符号,无需任何第三方。

我无法理解为什么“backgroundImage”颜色资源名称解析为符号“background”,并建议我将其重命名为“backgroundImage”。谁能解释一下这是什么原因吗?

有谁可以告诉我原因吗?

ios xcode warnings xcode15
1个回答
0
投票

您可以使用构建选项关闭自动生成: “生成资产符号”设置为“否”

© www.soinside.com 2019 - 2024. All rights reserved.