I'm having trouble defining this briefly.
I am using CoreData-generated classes, and extending them by defining
methods and calculated properties in categories on the generated classes (so
they don't get overridden if I regenerate the classes). All works fine for
properties with CoreData-defined types (scalars, strings, etc.), but not for
some hackery I'm using for properties with other types.

In a CoreData entity called "Topic", I have a to-many relationship (to other
Topics) called "children" to implement a hierarchy. In a category on Topic,
I have implemented a property called "orderedChildren" which returns a
sorted array of the children. In order to ensure that "orderedChildren" is
recognized as a property of the Topic entity, I have defined
"orderedChildren" as an optional, transient attribute of Topic of unknown
type (since NSArray or id isn't supported). CoreData generates a property
declaration for ""orderedChildren" with type UNKNOWN_TYPE, and I have
#defined UNKNOWN_TYPE as "id" in my precompiled header.

This all works up to a point: for example, NSArray *children =
aTopic.orderedChildren; works fine.

What doesn't work is defining a class method
+keyPathsForValuesAffectingOrderedChildren,
which I'd like to use to cause changes in the "children" relationship to
trigger change notifications for "orderedChildren".
keyPathsForValuesAffectingOrderedChildren is never called. (Overriding
keyPathsForValuesAffectingValueForKey: from a category is verboten.)

All this works on a category-implemented, transient, optional string
attribute on Topic. The only difference is the hackery around UNKNOWN_TYPE,
and I'm not sure I understand why that should make a difference.

Should I file a bug, or am I off-base?

Or is there a better way to wrap CoreData classes?

TIA,
Doug K;
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to