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: Yoann GINI <email@hidden>
- Date: Sat, 28 Jun 2008 20:41:39 +0200
Nota : userInfo pointer of kind NSNotification is a mistake, it's a
NSDictionary of course.
Le 28 juin 08 à 19:58, Yoann GINI a écrit :
A part of code (this is a simply try code for a R&D):
@interface root : NSManagedObject
@interface song : root
@interface artist : root
@interface modification : NSManagedObject
-(void)dataBaseHaveChange:(NSNotification*)notification //I
receive here the notification of a CoreData modification
{
NSNotification* userInfo = [[notification userInfo] retain];
NSSet* objectsSet = nil;
objectsSet = [userInfo valueForKey:NSInsertedObjectsKey];
for (NSManagedObject* modEntry in objectsSet) {
if ([modEntry isKindOfClass:[root class]]) {
//do something
}
}
//The same things for modified and deleted object
}
The aim of that is to record changement in the data base, but the
record is in data base too, and I don't want to catch the
modification of kind "modification", the solution retained for do
that it's do something only if the managed object is a subclass of
root. But actually the condition is never verified...
Le 28 juin 08 à 19:30, Mike Abdullah a écrit :
Post some code.
Mike.
On 28 Jun 2008, at 18:25, Yoann GINI wrote:
Ho sorry, of cours it's isKindOfClass, I've this problem since 2
days and I've try all similar method by despair !
With isKindOfClass I've always a NO in return...
Le 28 juin 08 à 19:15, Owen Yamauchi a écrit :
On Sat, Jun 28, 2008 at 9:58 AM, Yoann GINI
<email@hidden> wrote:
Do you have an idea ?
Use -isKindOfClass: instead. -isMemberOfClass: only tells you if an
object is an instance of that specific class. -isKindOfClass:
includes
all superclasses as well.
Owen
[forgot to reply-all]
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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