最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【吐槽Xcode的bug】Image图片文件拖进Assets后生成的配置文件有时候缺少字段

Xcode crifan 4238浏览 0评论

当一组x1,x2,x3的图片拖动到asset中后,正常应该生成对应的完整的配置

但是有时候缺少部分字段,

比如

1x部分,少了:

      "filename" : "file_icon_xls.png",

变成:

{
  "images" : [
    {
      "idiom" : "universal",
      "scale" : "1x"
    },
    {
      "idiom" : "universal",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "idiom" : "universal",
      "filename" : "[email protected]",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

导致编译出现警告:

assets.xcassets the image set has an unassiged child

assets.xcassets the image set has an unassiged child

 

去到对应的配置文件,Show in Finder:

right image show in finder

然后用文本编辑器打开对应的Content.json配置文件:

found image contents.json file open

去修改为:

{
  "images" : [
    {
      "idiom" : "universal",
      "filename" : "file_icon_xls.png",
      "scale" : "1x"
    },
    {
      "idiom" : "universal",
      "filename" : "[email protected]",
      "scale" : "2x"
    },
    {
      "idiom" : "universal",
      "filename" : "[email protected]",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

保存,即可解决此问题。

 

-》

有时候,把图片文件拖动到Xcode的Assets中之后,

好像是Xcode的bug,其自动生成的配置文件Contents.json中, 有时候会出现bug,对应的字段没有生成。

-》需要手动去编辑,添加对应字段,即可解决这类问题。

转载请注明:在路上 » 【吐槽Xcode的bug】Image图片文件拖进Assets后生成的配置文件有时候缺少字段

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.161 seconds, using 22.12MB memory