-textureWithContentsOfFile:options:error: incorrectly compares options values

Originator:preble
Number:rdar://12761147 Date Originated:11/27/2012
Status:Closed Resolved:3/13/2013
Product:Mac OS X SDK Product Version:10.8.2
Classification:Other Bug Reproducible:Always
 
Summary:
The GLKTextureLoader method -textureWithContentsOfFile:options:error: options dictionary has a key, GLKTextureLoaderGenerateMipmaps, which the documentation says is "an NSNumber object that specifies a boolean value".

If I use the following code to call this method, mipmaps are not generated as requested:

    BOOL generateMipmaps = YES;
    options = @{ GLKTextureLoaderGenerateMipmaps : @(generateMipmaps) };
    tex = [GLKTextureLoader textureWithContentsOfFile:path
                                              options:options
                                                error:NULL];

The method *does* generate mipmaps if I instead use the following options dictionary:

    options = @{ GLKTextureLoaderGenerateMipmaps : @YES };

The reason for this appears to be that @(YES) evaluates to an __NSCFNumber, and our guess is that -textureWithContentsOfFile:options:error: compares this value using "== kCFBooleanTrue", instead of sending the message -boolValue.  This method should use -boolValue or some similar mechanism to check the value in order to make it less susceptible to compiler subtleties.

Comments

Closed due to fixes in rdar://12761621.

Closed due to fixes in rdar://12761621.

Closed due to fixes in rdar://12761621.


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!