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: Bill Bumgarner <email@hidden>
- Date: Sat, 28 Jun 2008 11:14:44 -0700
On Jun 28, 2008, at 10:58 AM, Yoann GINI wrote:
@interface root : NSManagedObject
@interface song : root
@interface artist : root
@interface modification : NSManagedObject
Obj-C classes start with a capital letter, by convention. So -- Root,
Song, Artist, and Modification would be standard.
-(void)dataBaseHaveChange:(NSNotification*)notification //I
receive here the notification of a CoreData modification
{
NSNotification* userInfo = [[notification userInfo] retain];
No need to -retain the userInfo.
NSSet* objectsSet = nil;
objectsSet = [userInfo valueForKey:NSInsertedObjectsKey];
You want -objectForKey: -valueForKey: is for key value coding, -
objectForKey: is for extracting objects from a dictionary.
Shouldn't cause a problem.
for (NSManagedObject* modEntry in objectsSet) {
Are you sure objectsSet contains any objects?
if ([modEntry isKindOfClass:[root class]]) {
//do something
}
}
b.bum
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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