UIImage imageNamed: sometimes returns nil

Originator:jon513
Number:rdar://6121449 Date Originated:June 4, 2019
Status:Open Resolved:
Product:UIKit Product Version:
Classification: Reproducible:YES
 
-  have an image in the application bundle
 - in a background thread use imagedNamed: to access the image
 - background the app. 
expected:
 imageNamed should never return nil for images that are bundled with the app 
actual:
 sometimes it returns nil when access on a background thread when the app is backgrounded. Be aware - I am using the word "background" twice in two different contexts - it is not a mistake or confusion. 
Note: this does not seem to reproduce when using initWithContentsOfFile:
 this does not seem to reproduce when the images are stored in a asset catalog 
We talked to Tony from the foundation team about this at WWDC 2019

Comments

a sample project that demonstrates this bug can be found here: https://github.com/jon513/UIImageImageNamedBug


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!