KVC thinks properties with CGImage values are not KVC-compliant

Originator:boredzo
Number:rdar://7333955 Date Originated:2009-10-24T16:49-0700
Status:Open Resolved:
Product:Mac OS X Product Version:10.6.1
Classification:Other Bug Reproducible:Always
 
Summary:
KVC will claim that a class is not KVC-compliant for a key if the accessors for that key return and take a CGImageRef.

Steps to Reproduce:
1. Create a new project.
2. In the project, create a class with a property whose value is a CGImageRef. (It does not matter whether it's an Objective-C 2.0 property.)
3. Create a second class with a matching property and expose it as a binding.
4. Bind an instance of the second class to the property of an instance of the first class.

Expected Results:
The binding goes through and the instance of the second class receives change notifications any time the value of the property of the instance of the first class changes.

Actual Results:
valueForUndefinedKey: is sent to the instance of the first class, with the name of the property.

Regression:
No idea.

Workaround:
Type the accessors as returning and taking an NSObject pointer.

Notes:
I'm including a test app. It has two build configurations: One defines the accessors' type as CGImageRef, and the other defines their type as NSObject *. Simply switch the configuration back and forth to see the difference: With the type as NSObject *, the image observer receives the image from the image owner and puts it in the image view. With the type as CGImageRef, you get a KVC error (which I present as an alert in this test app).

[Test app: http://boredzo.org/radar-attachments/7333955/ObservingCGImagePropertiesTest-r1.tbz ]

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!