-[NSArray firstObject] should be public

Originator:steven.degutis
Number:rdar://7424179 Date Originated:25-Nov-2009 12:07 PM
Status:Duplicate/3058939 Resolved:1-Dec-2009 7:21 PM
Product:Developer Tools Product Version:3.2
Classification:Enhancement Reproducible:N/A
 
As of the Mac SDK that ships with Xcode (Developer Tools) 3.2, NSArray does not have a -firstObject method that is public. However, there is a private one with this name. Inexperienced ObjC coders often write categories without prefixing the method names (myself included) and can run into trouble unless this is either made public (and thus they delete their dangerous categories) or it is deleted (making their dangerous categories slightly less dangerous).

Comments

Because they might not behave the same in the future if Apple changes the implementation or return type/value, or if anyone else does who loads executable code into your app (via, say, a plugin).

By steven.degutis at Nov. 25, 2009, 7:21 p.m. (reply...)

Why is it dangerous if both methods behave the same?


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!