• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Core data save error with multiple persistent stores
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core data save error with multiple persistent stores


  • Subject: Core data save error with multiple persistent stores
  • From: Arthur C. <email@hidden>
  • Date: Sun, 16 Nov 2008 21:02:37 +0100
  • Importance: Normal

In my application I have two managed object contexts, as I need to be able to save two subsets of my Core Data setup separately.
These are both using one and the same persistent store coordinator; the coordinator has two stores.

I take care that every object instance gets inserted into the right managedObjectContext, by using [NSEntityDescription insertNewObjectForEntityForName: ...]. And it gets assigned to the right persistent store by using

- (void) awakeFromInsert
{
   ...
   [managedObjectContext assignObject:self toPersistentStore: [persistentStoreCoordinator persistentStoreForURL: url]];
}.
There are no relationships between objects in different persistent stores, as it should be.

This seems to work OK on one system, but leads to a strange error on two other systems (for the same program).

When a change has been made to the Core Data objects (e.g. adding an instance), the 'save' action of the managedObjectContext gives an exception (no error screen) saying 'can't reassign object to a different store once it has been saved'.
This means the Core Data stack cannot be saved anymore, which is of course a serious problem.

Do you know what causes this error? Do I need to use a different setup for the managedObjectContext - persistentStoreCoordinator - persistentStores system?


Thanks for your time,
Arthur C.


_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/_______________________________________________

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

  • Follow-Ups:
    • RE: Core data save error with multiple persistent stores
      • From: Arthur C. <email@hidden>
    • Re: Core data save error with multiple persistent stores
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: NSView positioning problems
  • Next by Date: Re: NSArrayController bound to an array of strings
  • Previous by thread: Re: NSView positioning problems
  • Next by thread: Re: Core data save error with multiple persistent stores
  • Index(es):
    • Date
    • Thread