This doesn't work with isKindOfEntity, used like that :

NSEntityDescription* rootDescription = [[NSEntityDescription entityForName:@"root" inManagedObjectContext:[self managedObjectContext]] retain];
...
        [rootDescription isKindOfEntity:[modEntry entity]]

It's always return NO...


Le 28 juin 08 à 19:32, mmalc crawford a écrit :

On Jun 28, 2008, at 10:15 AM, Owen Yamauchi wrote:

On Jun 28, 2008, at 9:58 AM, Yoann GINI wrote:
I've a CoreData base with some kind of object what are a subclass of an abstract class called "root" (root is a subclass of NSManagedObject). In a part of my code I need to catch all operation on object what are a child of root. For do that I use the notification NSManagedObjectContextObjectsDidChangeNotification and I would use "isMemberOfClass" method for test each objet. I don't know why but this method always return "NO" even of an object what are a chlid of root...

Use -isKindOfClass: instead. -isMemberOfClass: only tells you if an
object is an instance of that specific class. -isKindOfClass: includes
all superclasses as well.

isKindOfClass: includes all *subclasses* as well.

You should almost certainly, though, not be using class-based tests -- you should instead test the entity of the managed object (if you need to test for subentities, use isKindOfEntity).

mmalc


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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