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

Observing Core Data


  • Subject: Observing Core Data
  • From: Julio Cesar Silva dos Santos <email@hidden>
  • Date: Thu, 7 Sep 2006 19:48:59 -0300

Hi,

I am working on an application that uses Core Data and I am trying to implement a (quite) simple feature: Some entities have default values so I would like to add these values when the user launches the app for the first time. For this I have an NSArrayController bound to an entity and I thought that would be easy to observe it (using addObserver:forKeyPath:option:context and implementing observeValueForKeyPath:ofObject:change:context) but it is not. I have tested 'arrangedObjects.@count' KeyPath but it is only triggered when the array already has objects. No KeyPaths for NSArrayController are notified when the content is empty. My questions are:

1) Is it the right approach?

2) If it is, how can I tell whether the content is empty or not?

3) If it is not, should I observe another object (maybe NSManagedObjectContext)?

Thanks for any help,

Julio Cesar Silva dos Santos
email@hidden
Blogjective-C
http://www.jcs.santos.nom.br/wp
FetchYourLyrics
http://www.jcs.santos.nom.br/fyl/fyl.html


_______________________________________________ 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
  • Prev by Date: Re: NSPasteboard drag pasteboard hang
  • Next by Date: Re: Re: How do I get the NSApplication of other running applications?
  • Previous by thread: Re: NSPasteboard drag pasteboard hang
  • Next by thread: Re: Observing Core Data
  • Index(es):
    • Date
    • Thread