[UIImage imageNamed:] returning nil image for JPEGs with ~iphone suffixes

Originator:ash
Number:rdar://7317728 Date Originated:September 23, 2019
Status: Resolved:
Product: Product Version:
Classification: Reproducible:
 
In previous versions of the iOS SDK, an Xcode project could include the following two files in the app target and use imageNamed: to get the correct one for their device:

- image~iphone.jpg
- image~ipad.jpg

This behaviour changed with iOS 13 (even though the app in question could link against the iOS 12 SDK, or earlier). 

Steps to reproduce:

- Create an iOS project with Xcode 10.
- Add two identically-named images (except for ~iphone and ~ipad suffixes to distinguish between the device idioms).
- Try loading the image on an iOS 13 device

Expect results: you get the image.

Actual results: you get nil.

I have created an Xcode project to recreate the bug (and I have verified that it works as expected on iOS 12 devices): https://github.com/ashfurrow/ios-13-uiimage-crash I will also attach the directory to this bug report.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!