Re: Save in Core Data from another thread
Re: Save in Core Data from another thread
- Subject: Re: Save in Core Data from another thread
- From: Chris Hanson <email@hidden>
- Date: Mon, 29 Oct 2007 20:33:18 -0700
On Oct 29, 2007, at 5:57 PM, malcom wrote:
PrepareForSave:: save for NSSQLCore 0xf0b1670 is already in progress
Error Domain=NSCocoaErrorDomain Code=259 UserInfo=0x169235d0 "The
file “test” could not be opened because it is not in the right
format."
What's wrong in my code?
You haven't given us enough information to really say. You need to
show us what show us the code that actually performs the save, and
also the code that passes the messages to save.
Also, some naming convention issues with the code you have shown:
(1) Your -newIstanceManagedObjectContext method misspells "instance"
and should return a non-autoreleased object (since it starts with
"new").
(2) -storeList: is very generic, and mis-named to boot. An NSArray is
not a list; you would be better off calling it something like -
saveMessages:.
There's one other issue that may be at the heart of the whole matter,
and may mean that what you're attempting to do is simply unsupported:
Objects inserted in one managed object context are not made available
to other managed object contexts by Core Data until they are saved,
even if all of the managed object contexts involved share a persistent
store coordinator. In other words, only objects that are actually in
an underlying persistent store are available to all managed object
contexts via that persistent store.
-- Chris
_______________________________________________
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