Re: Core Data threading fun

2009-09-21 Thread Kyle Sluder
Have you remembered to merge changes whenever a thread's MOC posts NSManagedObjectContextDidSaveNotification? If the objects which are seeing the stale properties haven't been faulted out or hit their staleness interval, you will see this behavior. Take a look at the NSManagedObject methods

Re: Core Data threading fun

2009-09-21 Thread Luke Evans
Hi Kyle, Actually that's exactly what the doctor ordered (I think). I had missed this facet of using Core Data in across multiple threads. So, thank you very much. I'm sure you have saved me a lot of time. One last question comes to mind: As the NSManagedObjectContextDidSaveNotification will

Re: Core Data threading fun

2009-09-21 Thread Kyle Sluder
On Mon, Sep 21, 2009 at 11:43 AM, Luke Evans l...@eversosoft.com wrote: As the NSManagedObjectContextDidSaveNotification will be posted on the main thread, is it safe to do a -mergeChangesFromContextDidSaveNotification: on the main thread for any given MOC? This led to confusion a few months

Re: Core Data threading fun

2009-09-21 Thread Luke Evans
Thanks again Kyle. Great that -mergeChangesFromContextDidSaveNotification: does the Right Thing vis-a-vis working across threads. Would be a little awkward to keep it happy otherwise. Kudos to the Core Data folks (especially since the more I learn about Core Data the more I realise just

re: Core Data threading fun

2009-09-21 Thread Ben Trumbull
I have a server app that responds to network requests, making use of a Core Data database to serve responses. Some requests update the database. I have chosen to allow requests to arrive on multiple threads, and intend for these threads to use Core Data directly. In keeping with Core Data's doc

Re: Core Data threading fun

2009-09-21 Thread Luke Evans
Thanks Ben. Light testing suggests that I now have things working with - mergeChanges (modulo exactly which merge policy I should be using). Your notes provide some extra insight into some of the comments in the docs though (e.g. when you should lock the PSC). -- Luke On 2009-09-21, at