Re: core data, refreshObject, multiple threads
Re: core data, refreshObject, multiple threads
- Subject: Re: core data, refreshObject, multiple threads
- From: Chris Idou <email@hidden>
- Date: Sun, 7 Dec 2008 14:47:48 -0800 (PST)
--- On Sun, 7/12/08, John Clayton <email@hidden> wrote:
> From: John Clayton <email@hidden>
> Subject: Re: core data, refreshObject, multiple threads
> To: email@hidden
> Cc: email@hidden, "Steve Steinitz" <email@hidden>
> Received: Sunday, 7 December, 2008, 5:45 AM
> Chris,
>
> Can you make use of the -
> (void)refreshObject:(NSManagedObject *)object
> mergeChanges:(BOOL)flag method on NSManagedObjectContext?
See my original posting below.
>
> Thanks
> --
> John Clayton
> Skype: johncclayton
>
>
>
>
> On 7/12/2008, at 12:22 PM, Chris Idou wrote:
>
> > I've got fairly modest requirements, in so far as
> I'm using the XML store, and I'm happy to refresh
> the entire object graph of my worker thread when there is a
> change. So I've even tried [managedObjectContext reset]
> and querying from the beginning, but that doesn't seem
> to work either.
> >
> > I'm starting to think in terms of rebuilding the
> entire PersistentStoreCoordinator / ManagedObjectContext
> stack as a way to get new data. But a question I've had
> in the back of my mind for some time now, is there is no
> obvious way to close a NSPersistentStoreCoordinator or close
> a NSManagedObjectContext. Does one simply dealloc them, or
> in the case of garbage collection, just throw them away?
> Usually database type interfaces require some kind of close
> API
> >
> >
> > --- On Fri, 5/12/08, Steve Steinitz
> <email@hidden> wrote:
> >
> >> From: Steve Steinitz
> <email@hidden>
> >> Subject: Re: core data, refreshObject, multiple
> threads
> >> To: email@hidden
> >> Cc: email@hidden
> >> Received: Friday, 5 December, 2008, 4:04 PM
> >> Hi Chris,
> >>
> >> On 5/12/08, Chris Idou <email@hidden>
> wrote:
> >>
> >>> I've got a main thread that handles a gui,
> and a
> >> worker thread with its own
> persistentStoreCoordinator and
> >> managedObjectContext. The gui notifies the worker
> thread of
> >> a change, passing it an objectID, and the worker
> thread gets
> >> the object, and other objects it is connected to,
> and calls
> >> [managedObjectContext refreshObject: on them.
> >>>
> >>> But they don't seem to get an updated
> object.
> >> I'm using the XML store. The store is saved,
> I've
> >> checked that the new values are in the XML. But
> refresh
> >> doesn't seem to update anything. Is there any
> trick to
> >> it?
> >>
> >> Yes, I believe there are some tricks and also
> possibly some
> >> cases where it just won't update anything.
> Ben Trumbull
> >> was kind enough to contribute to a similar
> question I posted
> >> back in October. Here is the thread:
> >>
> http://www.mail-archive.com/email@hidden/msg19221.html
> >>
> >> In particular see his comment about the issue with
> small
> >> staleness intervals. At the time, I thought that
> had solved
> >> my problem but I've since discovered other
> scenarios
> >> where refreshObject doesn't update anything.
> Its
> >> possibly more likely to occur after optimistic
> locking
> >> errors (which, so far, I am unable to avoid). But
> I
> >> haven't yet demonstrated that with any degree
> of
> >> scientific method. I'm going to put it under
> the
> >> microscope again over the Christmas holidays.
> Feel free to
> >> stay in touch about it.
> >>
> >> Best regards and best of luck,
> >>
> >> Steve
> >
> >
> > Start your day with Yahoo!7 and win a Sony Bravia
> TV. Enter now
> http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline
> > _______________________________________________
> >
> > 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
Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline
_______________________________________________
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