• 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
Re: CoreData: "Can't reassign an object to a different store once it has been saved."?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData: "Can't reassign an object to a different store once it has been saved."?


  • Subject: Re: CoreData: "Can't reassign an object to a different store once it has been saved."?
  • From: Jim Correia <email@hidden>
  • Date: Fri, 15 Jul 2005 10:14:41 -0400

On Jul 15, 2005, at 9:19 AM, Jim Correia wrote:

Any idea what I've done wrong, and how to correct it?

I thought I was manually assigning newly created objects to the primaryStore, but I had a typo in one place, and didn't assign a helper object that was created in awakeFromInsert. After fixing those problems, I stopped getting the exception on save.


However...

The documentation says:
- (void)assignObject:(id)object toPersistentStore:(id)store

Specifies the store in which a newly inserted object will be saved. You can obtain the store identifier from the persistent store coordinator, using for example persistentStoreForURL:. It is only necessary to use this method if the receiver’s persistent store coordinator manages multiple writable stores that have the specified object’s entity in their configuration, otherwise it is unnecessary. Maintaining configurations in the managed object model can eliminate the need for invoking this method directly in many situations.
So it sounds like I can avoid all this manual assigning if I create a configuration, and then add the inMemoryStore to the coordinator using this configuration?

I've tried creating an InMemoryConfiguration for the Library entity, and letting the on disk store use a nil configuration, and without the manual assignObject:toPersistentStore:, it fails in the same way.

I also tried creating an explicit configuration for the xml store which contained all the entities except the Library, and it fails in the same way.

Does anyone have an example or simple explanation for how to set this up so I don't have to do the manual assign every time I insert an object?

Thanks,

Jim




_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >CoreData: "Can't reassign an object to a different store once it has been saved."? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Seeking advice: which "Design Patterns" book is best
  • Next by Date: Re: Displaying multiple NSView subclasses
  • Previous by thread: CoreData: "Can't reassign an object to a different store once it has been saved."?
  • Next by thread: Preserving the authority to run a command line tool as root
  • Index(es):
    • Date
    • Thread