3

I have created assets catalog, and specified images for backgrounds. I have only two images - one for iphone, another for ipad.

I manually edited Contents.json to re-use existed files.

"images" : [
    {
      "idiom" : "universal",
      "scale" : "1x",
      "filename" : "Background.png"
    },
    {
      "idiom" : "universal",
      "scale" : "2x",
      "filename" : "Background.png"
    },
    {
      "idiom" : "universal",
      "scale" : "3x",
      "filename" : "Background.png"
    },
    {
      "idiom" : "ipad",
      "scale" : "1x",
      "filename" : "Background-iPad.png"
    },
    {
      "idiom" : "ipad",
      "scale" : "2x",
      "filename" : "Background-iPad.png"
    }
  ],

What's the problem: when assets catalog compiled seems like image copied for each entry, so instead of two images, created 5 images. And that significantly increases app size.

I tried to create Contens.json independent of scale:

"images" : [
    {
      "idiom" : "universal",
      "filename" : "Background.png"
    },
    {
      "idiom" : "ipad",
      "filename" : "Background-iPad.png"
    }
  ],

It's correctly showing in xCode, but doesn't work on the device. App size reduced in 4MB.

Wether there is exist some workaround?

Mikhail
  • 4,271
  • 3
  • 27
  • 39

0 Answers0