• 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: NSPersistentDocument SQL Save As
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPersistentDocument SQL Save As


  • Subject: Re: NSPersistentDocument SQL Save As
  • From: Jesse Grosjean <email@hidden>
  • Date: Fri, 11 Nov 2005 16:05:56 -0500

I'm running into a strange problem and am looking for hints on what
might be the cause. I'm using NSPersistentDocument with an SQL
store. Saving works fine, but if I choose Save As... then data is
lost in the saving process. The data that is lost seems to be
specific to only one type of entity. And it only seems to be
attribute values (all of them) that are lost. The relationships for
the entity DO seem to be saved correctly.

Do you have a custom class implementation for this entity?

Any errors in the run log?

Are you sure that the data is actually in the object in question
(looking at it via nslog or something, not just the UI)?

Scott,

I've tracked this down further. It's not really a data loss problem, that was just a side effect... long story, but the short of it is the data is fine, but my custom class implementation accessor method (nonstandard implementation) weren't able to access it.

I'm still trying to figure out the exact problem, but I think it's because my code assumed that the managedObjectContext of each managed object would always match the managed object context of the document that owned those objects. But this isn't the case when using "Save As...". It seems that when "Save As..." is run the saved objects awakeFromFetch in a temporary managedObjectContext and then are later reassigned back to the original managedObjectContext held onto by the document.

So it's not a data-loss problem, just behavior that I didn't expect that caused the data-loss as a side effect.

Jesse
_______________________________________________
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


  • Prev by Date: Self-Updating Bundle
  • Next by Date: Re: Classes used to render webview content (tags)
  • Previous by thread: Re: NSPersistentDocument SQL Save As
  • Next by thread: Problem with dataWithPDFInsideRect
  • Index(es):
    • Date
    • Thread