• 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
Re: Core Data notifications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data notifications


  • Subject: Re: Core Data notifications
  • From: Bill Cheeseman <email@hidden>
  • Date: Sat, 08 Oct 2005 14:28:56 -0400
  • Thread-topic: Core Data notifications

on 2005-10-08 10:21 AM, Bob Peterson at email@hidden wrote:

> When a new Program is created it needs to show up
> in Master.sources.  Master observes
> NSManagedObjectContextObjectsDidChangeNotification and paws through
> the collections of added and deleted objects to see if any are
> Programs.  If so, then it does
>          [self willChangeValueForKey:@"countOfSources"];
>          [self didChangeValueForKey:@"countOfSources"];
> This (A) bugs me since I can't send willChangeValueForKey -before-
> the managed object context is changed, and (B) my ArrayController
> doesn't update the display of sources.
>
> How am I going about this wrong?

I solved this problem by using -awakeFromInsert instead of observing
NSManagedObjectContextObjectsDidChangeNotification. I found that the
notification isn't observed until the next iteration of the run loop, which
is too late to update the display. -awakeFromInsert is invoked in the same
iteration.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes


 _______________________________________________
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

References: 
 >Core Data notifications (From: Bob Peterson <email@hidden>)

  • Prev by Date: The trouble all began with WSMethodInvocationSetParameters
  • Next by Date: Re: Get selected NSManagedObject from a NSPopUpButton
  • Previous by thread: Core Data notifications
  • Next by thread: Programmatic -setHidden
  • Index(es):
    • Date
    • Thread