Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Joshua Garnham
Volker, I have tried using the below code to add my self as an observer then trigger an action but it doesn't work. - awakeFromNib { [self addObserver: self forKeyPath: @name options: NSKeyValueObservingOptionNew context: NULL]; } -(id)init {

Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Kyle Sluder
On Tue, Oct 6, 2009 at 11:32 PM, Joshua Garnham joshua.garn...@yahoo.co.uk wrote: - awakeFromNib { Okay, step 1: what the heck object is this? NSManagedObjects aren't going to have -awakeFromNib called on them (and you mustn't override their initializers) so it can't be one of those. Yet

Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Volker in Lists
Hi, you call addObserver on that CoreData object - which is a regular NSObject descendant anyway. So just as for every other NSObject you want to observe a property of. In case of CoreData objects you have to deal with it differently than with objects you create your self in your code

Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Volker in Lists
hi, which Kyle told you has nothing in common with a managedobject nor was it clear how that code was used. You have to call addObserver on the managed object and add the object that has to observe as observer. It really depends on your setup where to add what best. There exist a couple

Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Volker in Lists
Hi. Is this any better? See bewlo, and in addition: Did it work? It shouldn't have worked :-/ On NSManagedObject side: According to Apple the initWithEntity should not be overridden (http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdCreateMOs.html )

Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Volker in Lists
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

Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Kyle Sluder
Folks, Would you mind keeping this discussion either on- or off-list? It's kind of like listening to half of a telephone conversation. :-) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Joshua Garnham
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

Re: Triggering a Method when a Core Data Property is Altered.

2009-10-06 Thread Volker in Lists
Josh, depending on where you need to get a notification: a) within the same NSManagedObject or a relationship: