• 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
core data key/value observation failure
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

core data key/value observation failure


  • Subject: core data key/value observation failure
  • From: "John R. Timmer" <email@hidden>
  • Date: Thu, 02 Nov 2006 13:44:44 -0500

I'd assumed I was hallucinating, but this bug has now bitten me in two separate projects. During an "awakeFromNib" method, i have the following code, which loops through a series of managed objects:
aPref = [prefArray objectAtIndex: loopCounter];
[aPref addObserver: self forKeyPath: @"showInTable" options: NSKeyValueObservingOptionNew context: NULL];
NSLog ( [aPref valueForKey: @"theDisplayName"] );


The callback for changes just looks like this:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id) anObject change:(NSDictionary *)change context:(void *)context {
NSLog ( @"got a change notification" );
return;


The output of the run log is as follows:
2006-11-02 13:34:31.090 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.090 Mouse Manager[16164] Unique ID
2006-11-02 13:34:31.090 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.091 Mouse Manager[16164] Cage Name
2006-11-02 13:34:31.091 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.091 Mouse Manager[16164] Cage Location
2006-11-02 13:34:31.092 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.092 Mouse Manager[16164] Active
2006-11-02 13:34:31.092 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.092 Mouse Manager[16164] # of Mice
2006-11-02 13:34:31.093 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.093 Mouse Manager[16164] Mice

Which is all as it should be - one notification per object (presumably as they wake from fetch?). While using the app, however, changing one of these objects never triggers the notification (in this case, it's the object with "Active"). I cannot for the life of me figure out why, but i've seen the exact same behavior in a separate project.

I've searched the archives, but didn't come across this; if someone could help me out before I go insane, i'd appreciate it.

Cheers,

John




____________________________________ Science writer, Ars Technica (among other things) http://arstechnica.com/journals/science.ars



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: core data key/value observation failure - more information
      • From: "John R. Timmer" <email@hidden>
  • Prev by Date: Re: Pointers and NSImages
  • Next by Date: Re: [SOLVED] Open my Application via safari
  • Previous by thread: Re: Timeline View
  • Next by thread: Re: core data key/value observation failure - more information
  • Index(es):
    • Date
    • Thread