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 protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
