-[UIImage imageNamed:] no longer threadsafe

Originator:zacwest
Number:rdar://17812628 Date Originated:25-Jul-2014 11:28 AM
Status:Duplicate of 17672105 Resolved:
Product:iOS SDK Product Version:Version 6.0 (6A267n)
Classification: Reproducible:
 
Summary:
Prior to iOS 8, -[UIImage imageNamed:] was threadsafe, although not documented as such. However, since it is an alloc/init helper method, it does not seem like the type of thing to require being explicitly tagged as thread-safe.

Additionally, this method is the only way to access the asset catalog. This change makes asset catalogs available only on the main thread, which is not helpful for me.

I feel like some of the following need to happen if it to continue being non-threadsafe:

1) Explicitly tag the method in documentation as being not threadsafe. I've been doing Cocoa programming for something like 10 years now and I never would have assumed it's one of those "UIKit methods aren't threadsafe"-class things.
2) Give public methods to access the asset catalog to load images. I cannot do this myself, and -[UIImage imageNamed:] is my only mechanism to do so., and if it's not threadsafe, I cannot use asset catalogs off the main thread.
3) Create a new method which does the convenience @2x, ~iPad, etc., without the caching layer.
4) Reconsider making this method not threadsafe.

I would prefer this method return to being threadsafe because I have existing applications myself which implicitly depend on this behavior, and I don't feel like having them start crashing on iOS 8 unpredictably when they worked fine on iOS 7.

Steps to Reproduce:
1. Call -[UIImage imageNamed:] off the main thread.
2. Call -[UIImage imageNamed:] on the main thread.
3. Crash

Expected Results:
The program does not crash as the method is threadsafe.

Actual Results:
The program does crash.

Version:
Version 6.0 (6A267n)

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!