• 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: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument


  • Subject: Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument
  • From: Kyle Sluder <email@hidden>
  • Date: Sun, 21 Nov 2010 14:47:33 -0800

On Sun, Nov 21, 2010 at 2:32 PM, Dave Zwerdling <email@hidden> wrote:
>
> On Nov 21, 2010, at 11:37 AM, vincent habchi wrote:
>
> > Le 21 nov. 2010 à 20:09, Dave Zwerdling a écrit :
> >
> >> The issue lies in this: I have a background-thread reader of entities.  Because it is multithreaded, it uses a separate MOC for the entities to be read.  These MOCs have their persistent store coordinator the same as the document.  The background thread always returns faulted objects until the persistent document is saved.
> >
> > If this is your problem, this is normal. Until they are saved to the persistent document, newly created objects are local to their MOC and cannot be accessed elsewhere: upon creation, they are assigned temporary IDs.
> >
> > Vincent
>
> Is there a recommended way to enhance this to do what I need?  I assume I would need to create an in-memory store and keep the entities there, but how do I ensure that the documents will also make it to the persistent document on save?

Saving means writing things to the persistent store. You cannot share
unsaved objects between MOCs. Ergo, in order to get access to the
objects from the other MOC, the objects must already be in the
persistent store because the originating MOC has been saved.

What are you trying to accomplish?

--Kyle Sluder
_______________________________________________

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

  • Follow-Ups:
    • Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument
      • From: Dave Zwerdling <email@hidden>
References: 
 >Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument (From: Dave Zwerdling <email@hidden>)
 >Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument (From: vincent habchi <email@hidden>)
 >Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument (From: Dave Zwerdling <email@hidden>)

  • Prev by Date: Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument
  • Next by Date: Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument
  • Previous by thread: Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument
  • Next by thread: Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument
  • Index(es):
    • Date
    • Thread