Re: Core Data: Save As workflow
Re: Core Data: Save As workflow
- Subject: Re: Core Data: Save As workflow
- From: Greg Herlihy <email@hidden>
- Date: Tue, 25 Apr 2006 21:40:56 -0700
- Thread-topic: Core Data: Save As workflow
On 4/25/06 1:30 PM, "Pierre Bernard" <email@hidden> wrote:
> Hi!
>
> I am wondering what happens exactly when a Core Data document is
> saved to an new location.
Exactly what happens when the document is saved to the old location. Nothing
is any different except the location of the saved file.
> Let's say I start with an existing document. As it is loaded objects
> are fetched into memory. Objects are held in controllers and bound to
> view elements.
>
> Now I save the document to a new location. As a new file is created,
> I _guess_ an new persistent store is created. That would imply
> swapping out the whole persistence stack.
No. Saving a file to the old location creates a new file as well - it just
overwrites the old one. So the same store is used for the newly-saved file
in either case.
> Somehow the object graph then has to be migrated to or recreated in
> the new managed object context. I just can't imagine how that could
> go about. Controllers and views have references to managed objects.
> Thus creating the objects afresh seems impraticable. But can objects
> be migrated to a new object store?
There is no new persistent store. Nothing is migrated. There is only one way
to save a document, after all. Or to put it another way: would the location
of the saved file make any difference to its contents?
> Seeing that I occasionally see the following error after saving a
> document, I got the understanding that migrating is not possible.
> "CanĀ¹t reassign an object to a different store oncebeen saved. "
>
> Now I am confused.
>
> The reason I am asking is of course that I have a problem to solve.
>
> Upon 2 successive save-as operations on my document based
> applications I am seeing debug messages like the one below:
>
> 2006-04-25 06:40:41.966 HoudahSpot[3627] Cocoa Bindings: Error
> accessing value for key path selection.queryAttribute of object
> <NSObjectController: 0x5a545c0>[entity: QueryItem] (from bound object
> <NSPopUpButton: 0x5a47610>): [<QueryLeaf 0x3aa470>
> valueForUndefinedKey:]: this class is not key value coding-compliant
> for the key queryAttribute.
I would guess that the problem is simply that some custom accessor routines
are not sending the proper key-value observing compliant notifications (such
as willAccessValueForKey: and so forth). The lack of proper notifications
will prevent a document from being saved (or saved as) correctly.
Greg
_______________________________________________
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