• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Observer CoreData Objects changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Observer CoreData Objects changes


  • Subject: Observer CoreData Objects changes
  • From: Dex Morgan <email@hidden>
  • Date: Sun, 27 Apr 2008 00:03:29 +0200

Hello,
I need to observe from a controller class when a particular attribute of a NSManagedObject in my persistent store is changed.
I've tried with:
- (BOOL)validateValue:(id *)value forKey:(NSString *)key error: (NSError **)error


in my class. Unfortunatly I need to keep the old value in order to make a comparison between it and the new value (id* value) and this method does not allow it.
So I've tried using


- (void) addObserver:<#(NSObject *)observer#> forKeyPath:<#(NSString *)keyPath#> options:<#(NSKeyValueObservingOptions)options#> context:<#(void *)context#>

but the only way to keep changes of all objects is to put this method into the init of my class (inside a subclassed method - (id)initWithEntity:(NSEntityDescription *)entity insertIntoManagedObjectContext:(NSManagedObjectContext *)context).
Bleah, it's not a great solution right?
Anyone can point to me to the right way?


Thanks in advanced
_______________________________________________

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


  • Follow-Ups:
    • Re: Observer CoreData Objects changes
      • From: Ben Lachman <email@hidden>
  • Prev by Date: Re: Sheet window as firstResponder
  • Next by Date: Re: Caching a local file using NSURLCache
  • Previous by thread: Re: Problem with Memory Leaks
  • Next by thread: Re: Observer CoreData Objects changes
  • Index(es):
    • Date
    • Thread