i hope someone can help me…
my code look like this
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(makeSomeThing:) name:NSManagedObjectContextObjectsDidChangeNotification
object:nil];
i want to know which entity has changed no matter delete or update. just
which entity…
i want do something like that
-(void)makeSomeThing: (NSNotification *)noti
{
if(entity == CarEntity)
NSLog(@"makeSomeThing");
}
i can not figure out what entity has changed… i know there is a method [noti userInfo] but
i dont know what to do whit this.
thx and sorry for this horrible englich 🙂
The NSDictionary returned by
[noti userInfo]forNSManagedObjectContextObjectsDidChangeNotificationmay contain keys NSInsertedObjectsKey, NSUpdatedObjectsKey, and NSDeletedObjectsKey. So[[noti userInfo] objectForKey:NSInsertedObjectsKey]will give you the objects inserted; the other two keys work similarly.Do note that multiple objects can be inserted, updated, and/or deleted in one notification.