• 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: Any way for a managed object to get at its document object?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any way for a managed object to get at its document object?


  • Subject: Re: Any way for a managed object to get at its document object?
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 7 Oct 2010 15:35:27 -0700

On Oct 7, 2010, at 15:14, Rick Mann wrote:

> I have an NSPersistentDocument-based app. I need to implement a "setNeedsFoo" method on the managed object that causes the receiver to be placed into an NSMutableSet on the document, for later "foo" processing. As part of being added to the set, it sets a timer in the document so that this set of objects gets processed.

1. Search the (singleton) document controller's "documents" array for a document that's of class NSPersistentDocument and whose "managedObjectContext" property matches that of the object.

2. Subclass NSPersistentDocument and have it maintain a (singleton) NSMapTable that maps from the document's managed object context pointer (key) to the document object (value). Alternatively, you could subclass NSDocumentController instead to maintain such a mapping.

There may well be a more direct way, but the above sprang immediately to mind.


_______________________________________________

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

References: 
 >Any way for a managed object to get at its document object? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: NSComboBox bound to NSMutableArray of NSMutableDictionary with NSArrayController?
  • Next by Date: Re: Any way for a managed object to get at its document object?
  • Previous by thread: Any way for a managed object to get at its document object?
  • Next by thread: Re: Any way for a managed object to get at its document object?
  • Index(es):
    • Date
    • Thread