7

So just when I though my swift 2 upgrade could not get any worse its seems that you cannot add retina 4" 2x image assets anymore. I cannot fine any option anymore to add it, all my old assets still have the retina 4" image but I cannot create a new image set with a 4" retina image. Why?

Any ways to fix this?

Josip Ivic
  • 3,639
  • 9
  • 39
  • 57
crashoverride777
  • 10,581
  • 2
  • 32
  • 56

3 Answers3

5

Edit Contents.json of the Image Set and add

{
  "idiom" : "iphone",
  "subtype" : "retina4",
  "scale" : "2x"
}

You will see appear Retina 4 2x entry.

Giorgio
  • 1,973
  • 4
  • 36
  • 51
  • Thanks for your help. Could you be a tiny be more specific of where this contents.json is exactly please, never used it before. Thanks – crashoverride777 Oct 28 '15 at 23:00
  • 1
    Right click in your image assets -> Show in Finder. You will see a folder with some png and a Contents.json file. There is a Contents.json file for each image assets in your project. – Giorgio Oct 29 '15 at 08:20
  • Thank you very much, it works great. I wonder why apple did not tell me about this? Any ideas why that would be? – crashoverride777 Oct 29 '15 at 12:52
  • I don't know. Maybe Apple removed it but, for back compatibility, Xcode still recognizes subtype "retina4". – Giorgio Oct 29 '15 at 13:45
2

Spoke to apple, turns out they removed it on purpose.

Basically this is the answer I got. I was having a TSI open for another issue so didn't ask further questions.

"Regarding the lack of 4” iPhone image sets in Assets Catalogs (in Xcode 7+) our assets catalog supporter, Justin, says its been removed by design and to file an enhancement request if you want it back. When you do, however, be sure it tell the assets catalog team your use case and why you need it. There are a number of solutions to consider as the way to cope with this moving forward but I encourage you to file a new TSI to talk with Justin more about it."

Update:

I am no longer using retina 4" images, it is better to use Universal images or iPhone specific images available and let xCode do the scaling for you on the smaller devices.

crashoverride777
  • 10,581
  • 2
  • 32
  • 56
  • The reason? What replaces it? – Van Du Tran Oct 22 '15 at 20:13
  • 2
    Basically this is the answer I got. I was having a TSI open for another issue so didn't ask further questions. "Regarding the lack of 4” iPhone image sets in Assets Catalogs (in Xcode 7+) our assets catalog supporter, Justin, says its been removed by design and to file an enhancement request if you want it back. When you do, however, be sure it tell the assets catalog team your use case and why you need it. There are a number of solutions to consider as the way to cope with this moving forward but I encourage you to file a new TSI to talk with Justin more about it." – crashoverride777 Oct 23 '15 at 20:50
  • 1
    What are the "number of solutions"? How are we supposed to deal with different resolutions for full screen backgrounds? – Van Du Tran Oct 27 '15 at 00:19
  • 2
    Basically I just realised even in my old projects where I still have retina 4 inch assets or even uses the above trick will not work. It is ridiculous. On iPhone 5 there are now no backgrounds at all and on iPhone 5s there are backgrounds but they seem to be the 2x images. What are we meant to do? – crashoverride777 Nov 07 '15 at 13:46
2

so I asked them again what we should do if we need to scale images precisely for the 4 inch retina screen.

"What is preventing you from being able to apply the special casing code whereby you check the device type and do something different for iPhone 5, 5s, 5c?

i.e.

if ([platform isEqualToString:@"iPhone5,1"])    return @"iPhone 5 (GSM)";
if ([platform isEqualToString:@"iPhone5,2"])    return @"iPhone 5 (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone5,3"])    return @"iPhone 5c (GSM)";
if ([platform isEqualToString:@"iPhone5,4"])    return @"iPhone 5c (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone6,1"])    return @"iPhone 5s (GSM)";
if ([platform isEqualToString:@"iPhone6,2"])    return @"iPhone 5s (GSM+CDMA)"

Have you filed a feature request for this ability yet? (using Apple Bug Reporter) "

Not really satisfied with the answer at all because I obviously know how to check what kind device is running my app/game.

How does that help me to add a image to my asset catalogue that is only used for the retina 4 inch screen? You know like I could do before without any issues at all. It seems beyond stupid to remove retina 4 inch assets, makes no sense to me.

Also in regards to the JSON tip for Giorgio, it still seems to work actually, i think my simulator on a iPhone 5 is just messed up.

crashoverride777
  • 10,581
  • 2
  • 32
  • 56