Re: Core Data & NSPersistentDocument & Concurrency
Re: Core Data & NSPersistentDocument & Concurrency
- Subject: Re: Core Data & NSPersistentDocument & Concurrency
- From: Felix Franz <email@hidden>
- Date: Sat, 02 Feb 2013 11:59:53 +0100
On 02.02.2013, at 00:59, Mike Abdullah wrote:
>
> One downside of that is whenever a child needs to fetch data, it must do so via the main context, blocking the main thread while doing so. Depending on your model, that may prove unacceptable. If so, your better bet is to have a single "root" context with its own private queue. Make the main context a child of it. And then also make any background contexts children of it.
>
> At that point, you start to leave NSPersistentDocument's remit. I have code here demonstrating how to do subclass NSDocument directly for this setup:
>
> https://github.com/karelia/BSManagedDocument
> (make sure you checkout the ksmanageddocument branch!)
>
> One great advantage is it leverages the root context to implement asynchronous saves. Out of the box it is designed to match UIManagedDocument's document package layout, but I'm sure you could adjust that. Or perhaps just re-use bits of the code in your NSPersistentDocument subclass.
>
thank you! We just started to support 10.7+ and my first experiments in our NSPersistentDocument based
application to use child-contexts wasn't this satisfactory. I will look into your code.
Concerning child-contexts: By googling around I found http://wbyoung.tumblr.com/post/27851725562/core-data-growing-pains
which makes me a little bit nervous. If someone has experience using them on 10.7+ I would like to hear
your experiences.
Cheers,
Felix
_______________________________________________
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