Hi, That works now, Thanks Very Much!!!
Josh. ________________________________ From: Volker in Lists <volker_li...@ecoobs.de> To: Joshua Garnham <joshua.garn...@yahoo.co.uk> Cc: cocoa-dev@lists.apple.com Sent: Wednesday, 7 October, 2009 18:04:59 Subject: Re: Triggering a Method when a Core Data Property is Altered. Hi, awakeFromFetch is only called when the object is loaded from the persistent store (=fetched). So all newly inserted objects are not observed. this might be one reason for not getting triggered for rows 2/3 if they were not fetched but created. Otherwise I have no idea why it doesn't work yet- Volker Am 07.10.2009 um 18:54 schrieb Joshua Garnham: Hi, > >Ok, I have changed it to awakeFromInsert: and have removed the observer in the >NSManagedObjects dealloc: method. >And have already fixed the performSelector: problem. > >So the NSManagedObject sub-class looks like … > >- (void) awakeFromFetch { > [self addObserver:[NSApp delegate] forKeyPath:@"name" > options:NSKeyValueObservingOptionNew context:nil]; >} > >- (void)dealloc { > [self removeObserver:[NSApp delegate] forKeyPath:@"name"]; > [super dealloc]; >} > > >… and the App Delegate … > >- (void)observeValueForKeyPath:(NSString *)keyPath > ofObject:(id)object > change:(NSDictionary *)change > context:(void *)context { > [self performSelector:@selector(doSomthing:)]; >} > >It builds without any warnings but it only half works. >What happens is as follows … >In my table view I have added three rows, each have text fields bound to the >'name' property. >The method is triggere when I change the text for the first row however it is >not triggered when I change the text for the >other rows. Do you have any idea why this is? _______________________________________________ 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 arch...@mail-archive.com