There are several answers on SO already about "imageNamed:" not working, but none have included my particular wrinkle:
I'm getting nil
from "imageNamed:" on iOS 7, but the same build works on iOS 8.
Obviously, everything is hooked up properly because it does work on iOS 8, but it consistently returns nil
for a wide range (maybe 2 dozen) of images on iOS 7. Notably, I moved the assets to an AssetCatalog around the time this started. Is there some unusual behavior of asset catalogs on iOS 7 that has to be accounted for?
Here are some details, based on the answers to similar questions on this site:
By far the majority of the answers on SO are for bugs that would prevent it from working at all. Can anyone help with an image call that only works on iOS 8?
Huh. So apparently the solution was that if your imageset in the Asset Catalog has a file suffix within its name, iOS 7 gets tripped up. We've got several versions of each file in our Asset Catalog, the same image but for different uses, so my coworker had named them with the old filename like so:
"RedBall.png - Small" (includes 25px, 50px, 75px)
"RedBall.png - Large" (includes 150px, 300px, 450px)
"BlueBall.png - Small"
"BlueBall.png - Large"
Apparently iOS 8 is smart enough to recognize that "RedBall.png - Small" is the name, while iOS 7 doesn't know what to do when ".png" is right there in the middle.
Renaming the files to...
"RedBall - Small"
"RedBall - Large"
"BlueBall - Small"
"BlueBall - Large"
...seems to do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With