Why isn't my Asset Catalog returning R4 images?

11,838

Solution 1

For the R4 image to be automatically selected by Xcode you have to change the iOS Target to iOS 7. So even if you use the iOS7 SDK, your project target must be iOS 7.

Solution 2

I have found answer thanks to this. Subtype R4 in Asset Catalog works only with iOS 7 and higher. In other case it will use @2x image.

Solution 3

I have same issue and scratched hours. I use localized launch images which make it more complicate. After all, I just change back and not use asset catalog. Name the launch images as Default.png , [email protected] and [email protected]. Localized and Put them in the bundle and make ios recognize automatically. Everything works fine.

Solution 4

The solution that we have used is to update the asset catalog and target only iOS 6 and Prior.

How to do it. Go to the asset catalog. And on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images. Uncheck the iOS 7 check boxes for iPhone. Now you should be able to see the launch images for these devices. Doing this you will use the 2x Image for R4 as well.

Solution 5

The R4 image worked for me only with this process:

  1. Delete the problem Image View from the storyboard
  2. Add a brand new Image View to replace it with the expected asset name, e.g. "Derp"
Share:
11,838

Related videos on Youtube

Neal Ehardt
Author by

Neal Ehardt

I'm into UI, robotics, and volumetric displays.

Updated on June 17, 2022

Comments

  • Neal Ehardt
    Neal Ehardt about 2 years

    I'm in the process of migrating my images to an Asset Catalog. My app needs to access the Launch Image after launch and display it on the screen.

    Easy enough, but I have different images for short and tall iPhones, and my iPhone 5 is loading the short launch image when I call [UIImage imageNamed:@"LaunchImage"].

    Okay so maybe I can't do this with a Launch Image. I'll try putting some images in a normal Image Set instead.

    Image Set

    No dice. Using an iPhone 5, when I call [UIImage imageNamed:@"Derp"] OR when I set an image in Interface Builder, I get the 2x (retina) image instead of the R4 (retina 4-inch) image.

    Is this feature broken? How to I get the R4 image on my iPhone 5 (iOS 7)?

  • Neal Ehardt
    Neal Ehardt almost 11 years
    Unrelated to my immediate problem, but it is a showstopper. Why, Apple? ಠ_ಠ
  • toblerpwn
    toblerpwn over 10 years
    I have found this untrue in my testing; specifically, R4 is only used when the Deployment Target is iOS 7.0. The device's version does not seem to matter. @Coolsinus has correctly stated this below.
  • Thangavel
    Thangavel over 10 years
    I changed iOS target to iOS7. But app not work in iOS6. how to fix this issue in iOS6. I want my R4 image work in both 4inch screen(iOS6 and iOS7)
  • João Nunes
    João Nunes over 10 years
    I changed to ios 7 only and it works. Then i changed my project again to ios 6 and r4 still works.. maybe after cleaning will stop working.
  • Alejandro Benito-Santos
    Alejandro Benito-Santos over 10 years
    @JoãoNunes FWIW it keeps working until you remove the app from the device. I tried cleaning and clearing derived data and still worked... #AppleWTF
  • João Nunes
    João Nunes over 10 years
    for me the clean project stoped to work. This is an obscure feature :P
  • cynistersix
    cynistersix about 10 years
    This is correct use a UIImage category to get a naming scheme and add another image asset to the xcasset to fetch
  • xarly
    xarly about 10 years
    I made this, changing the options of 'Attribute Inspector' for the Icons of the app. But, unfortunately is not working properly for iPhones 4 inches with iOS 6.