Re: Using isMemberOfClass with a tree of subclass of NSManagedObject
Re: Using isMemberOfClass with a tree of subclass of NSManagedObject
- Subject: Re: Using isMemberOfClass with a tree of subclass of NSManagedObject
- From: mmalc crawford <email@hidden>
- Date: Sat, 28 Jun 2008 10:32:12 -0700
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 (email@hidden)
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:
This email sent to email@hidden