Re: Core Data: Multiple stores: saving problems
Re: Core Data: Multiple stores: saving problems
- Subject: Re: Core Data: Multiple stores: saving problems
- From: Jonathan Fewtrell <email@hidden>
- Date: Mon, 12 Jul 2010 10:44:38 +0800
> On 2010 Jul 10, at 04:10, Jonathan Fewtrell wrote:
>
>> when I come to save *the* context
>
> Reads like you're using only one managed object context. I would use two: one for your static data and one for your user data.
I'll try it with two contexts. Could you explain why you think this would be better? What I have read suggests that using two contexts can be fiddly when you have relationships between the objects in the two; that's why I went with one.
>
>> I have a cross-store relationship
>
> Boing. Read Core Data Programming Guide > Relationships and Fetched Properties > Cross-store Relationships.
Yes, I've read this several times. And everything else I can Google on cross-store relationships. Maybe the answer is there and I just don't see it.
I solved the problem about -willSave not being called. That was just dumbness on my part. I'd forgotten to tell the model that I had subclassed NSManagedObject for the relevant entity. However, with that fixed, the fundamental problem remained that Core Data rejected the save operation because it "Cannot update objects into a read only store." even though only transient properties had changed on the objects involved in the configuration for that store.
I have now rewritten things to use a fetched property rather than a relationship on one side. This looks promising (doesn't work yet, but I'm optimistic), but I'd still like to understand why using a two-way relationship doesn't work.
_______________________________________________
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